-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fs.Dir.deleteTree
has no upper bound on retries
#15465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Previously, it was possible for deleteTree to get into a state where it would continually retry deleting the same directory over and over infinitely, since it would think all of the children were successfully deleted but when deleting the directory it would hit `error.DirNotEmpty`. Now, there is a (user-configurable) limit to the number of times it will retry deleting directories, and return `error.TooManyRetries` if the limit is exceeded. Closes ziglang#15465
Previously, it was possible for deleteTree to get into a state where it would continually retry deleting the same directory over and over infinitely, since it would think all of the children were successfully deleted but when deleting the directory it would hit `error.DirNotEmpty`. Now, there is a (user-configurable) limit to the number of times it will retry deleting directories, and return `error.TooManyRetries` if the limit is exceeded. Closes ziglang#15465
I don't think a max number of retries is the correct solution here. The calling code of deleteTree should instead receive some kind of error message such as "directory contains open file handles" or something to that effect. The idea that you have to choose how many retries to delete things doesn't make any sense. You either delete something, or fail to delete something. That's the API that std lib needs to have. |
As far as I'm aware, it's not possible to detect a condition like "directory contains open file handles," or otherwise know if the retries will ultimately be successful ahead-of-time. There are currently two main scenarios (there may be more that I'm unaware of) that can cause a retry to happen in the current
It would be possible to treat |
Zig Version
0.11.0-dev.2777+b95cdf0ae
Steps to Reproduce and Observed Behavior
This was meant to be a follow-up issue of #13073 (comment)
As I understand it, the CI has been running into infinite loops on Windows due to
DELETE_PENDING
when file handles don't get closed (#15450, #15460).Here's a minimal reproduction:
Expected Behavior
deleteTree
should error with something likeerror.TooManyRetries
after some user-configurable amount of retries.The text was updated successfully, but these errors were encountered: