Skip to content
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

Fix issue 1414- add proper behavior of clear() to DiskBackedQueue #1415

Closed

Conversation

biotinker
Copy link

@biotinker biotinker commented Aug 28, 2019

Description

Fix bug in DiskBackedQueue.

DiskBackedQueue.closeIOResources() was using IOUtil.deletePaths() to clean up its temp file, but IOUtil.deletePaths() splits a given path into an array of filenames, and there is no function in IOUtil that would properly remove this one path (without needlessly wrapping the temp file in an iterator).

I copied the try/catch that does the file deletion in IOUtil.deletePaths() to the correct place within closeIOResources, and it now works as expected.

@biotinker biotinker changed the title Fix issue 1414 Fix issue 1414- add proper behavior of clear() to DiskBackedQueue Aug 28, 2019
@codecov-io
Copy link

codecov-io commented Aug 28, 2019

Codecov Report

Merging #1415 into master will decrease coverage by 0.008%.
The diff coverage is 100%.

@@               Coverage Diff               @@
##              master     #1415       +/-   ##
===============================================
- Coverage     68.124%   68.116%   -0.008%     
+ Complexity      8379      8378        -1     
===============================================
  Files            573       573               
  Lines          33982     33986        +4     
  Branches        5668      5668               
===============================================
  Hits           23150     23150               
- Misses          8643      8646        +3     
- Partials        2189      2190        +1
Impacted Files Coverage Δ Complexity Δ
...ain/java/htsjdk/samtools/util/DiskBackedQueue.java 65.487% <100%> (+1.267%) 29 <0> (ø) ⬇️
...htsjdk/samtools/util/nio/DeleteOnExitPathHook.java 80.952% <0%> (-9.524%) 3% <0%> (-1%)
src/main/java/htsjdk/samtools/util/IOUtil.java 57.627% <0%> (-0.484%) 118% <0%> (ø)

@lbergelson
Copy link
Member

@biotinker Thank you for identifying this problem and producing a patch! This pr looks like it solves the problem, but I think in this case changing the underlying problem in the method is justified.

The behavior you identified in IOUtil.deletePaths(Iterable<Path>) is REALLY bad. It was essentially a copy of the old method IOUtil.deleteFile and no one noticed that Path is itself and Iterator<Path>.

Rather than working around the pathological behavior I'm opening a new PR to fix the underlying problem with the method since it's completely broken.

Would you mind reviewing #1416 and making sure it solves your problem?

@lbergelson
Copy link
Member

@biotinker I merged the alternate pr that made fixes to the underlying method. Thank you for identifying this and opening a pr to fix it!

@lbergelson lbergelson closed this Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants