-
Notifications
You must be signed in to change notification settings - Fork 245
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
DiskBackedQueue closeIOResources is broken #1414
Labels
Comments
That sounds nasty... Will fix. Thank you for reporting that. |
Just added a PR with a fix |
Oh, that's even better :) . Thank you. |
lbergelson
added a commit
that referenced
this issue
Aug 29, 2019
* The method IOUtil.deletePaths(Iterable<Path>) had pathological. * A Path is an Iterable<Path> which iterates over the subpaths in the Path. Therefore, this version was binding instead of the varargs version that takes Path... Then the method would try to delete all of the subpaths in the path. * This is obviously bad behavior. Fixed by adding an explicit check to see if it's called with a single Path. * Extracted a new method deletePath which is used for deleting a single path. * Fixes ##1414
lbergelson
added a commit
that referenced
this issue
Aug 30, 2019
* The method IOUtil.deletePaths(Iterable<Path>) had pathological. * A Path is an Iterable<Path> which iterates over the subpaths in the Path. Therefore, this version was binding instead of the varargs version that takes Path... Then the method would try to delete all of the subpaths in the path. * This is obviously bad behavior. Fixed by adding an explicit check to see if it's called with a single Path. * Extracted a new method deletePath which is used for deleting a single path. * Fixes ##1414
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of the issue:
When calling clear() on a DiskBackedQueue, rather than deleting the file in question, the path to the temp file is split into its constituent pieces and each treated as file names to be deleted- thus failing to delete the intended file, and potentially deleting random other files.
This is due to the use of IOUtil.deletePaths, which calls Arrays.asList() on whatever you pass it, converting our correct Path into an array of the folder names making it up.
Steps to reproduce
Create a DiskBackedQueue with some directory for TMP_DIR, fill it enough that it spills to disk, and then call clear() on it
Expected behaviour
The temp file should be deleted
Actual behaviour
The folder names making up the path to the temp file are treated as file names, and each of these file names attempt deletion from the current working directory.
The text was updated successfully, but these errors were encountered: