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
8276994: java/nio/channels/Channels/TransferTo.java leaves multi-GB files in /tmp #6360
Conversation
|
@LanceAndersen The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Thanks for taking this one. I guess it should really be Files.delete as both files do exist, leaving it as deleteIfExists is okay. It's possible that creating targetFile will fail and leave sourceFile behind but it will be an empty file so won't fill up the file system. You should use a nested try-finally to avoid these issues. But what you have is okay for now.
@LanceAndersen This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 51 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
Files.deleteIfExists(sourceFile); | ||
Files.deleteIfExists(targetFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about an exception thrown from Files.deleteIfExists(sourceFile)
in that finally
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right - maybe that should be done in a private method where the exception would be catch'ed and logged (printStackTrace
) - otherwise an exception in the finally clause risks masking any exception that was thrown before the finally clause was reached.
Path targetFile = null; | ||
try { | ||
// preparing two temporary files which will be compared at the end of the test | ||
sourceFile = Files.createTempFile("test2GBSource", null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this throws then Files.delete(sourceFile) will throw an NPE. I think it would be just a bit more robust to initialize sourceFile to Files.createTempFile(...) rather than null.
/integrate |
Going to push as commit b0d7a9d.
Your commit was automatically rebased without conflicts. |
@LanceAndersen Pushed as commit b0d7a9d. |
Hi,
This patch addresses the issue where the very large temp files are not cleaned up after the testMoreThanTwoGB completes.
Best
Lance
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6360/head:pull/6360
$ git checkout pull/6360
Update a local copy of the PR:
$ git checkout pull/6360
$ git pull https://git.openjdk.java.net/jdk pull/6360/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6360
View PR using the GUI difftool:
$ git pr show -t 6360
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6360.diff