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

8276994: java/nio/channels/Channels/TransferTo.java leaves multi-GB files in /tmp #6379

Closed
wants to merge 3 commits into from

Conversation

mkarg
Copy link
Contributor

@mkarg mkarg commented Nov 13, 2021

This PR proposes to cleanup all temp files of the TransferTo test, not just the 2GB files. Also it separates the actual test logic from the cleanup logic, so the test cases are simple to understand again as they are not interwoven with cleanup code anymore.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8276994: java/nio/channels/Channels/TransferTo.java leaves multi-GB files in /tmp ⚠️ Issue is not open.

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6379/head:pull/6379
$ git checkout pull/6379

Update a local copy of the PR:
$ git checkout pull/6379
$ git pull https://git.openjdk.java.net/jdk pull/6379/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6379

View PR using the GUI difftool:
$ git pr show -t 6379

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6379.diff

@mkarg
Copy link
Contributor Author

@mkarg mkarg commented Nov 13, 2021

@AlanBateman As proposed by my earliert today in the JIRA discussion. WDYT?

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Nov 13, 2021

👋 Welcome back mkarg! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

@openjdk openjdk bot commented Nov 13, 2021

@mkarg The following label will be automatically applied to this pull request:

  • nio

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.

@openjdk openjdk bot added the nio label Nov 13, 2021
@mkarg mkarg changed the title Cleaning up temp files 8276994: java/nio/channels/Channels/TransferTo.java leaves multi-GB files in /tmp Nov 14, 2021
@openjdk openjdk bot added the rfr label Nov 14, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Nov 14, 2021

Webrevs

Copy link
Contributor

@LanceAndersen LanceAndersen left a comment

thank you for cleaning up the additional temp files created by this test. Please see comments below.

}
} finally {
Files.delete(sourceFile);
// preparing two temporary files which will be compared at the end of the test
Copy link
Contributor

@LanceAndersen LanceAndersen Nov 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep the previous changes to this test. We went through a few iterations off line. We would also prefer to delete these files at the end of the test, not just the over all test run due to their size.

Copy link
Contributor Author

@mkarg mkarg Nov 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As all the other tests in this test class run rather quick (within seconds) I wonder what you expect to actually gain? The difference would just be some seconds of earlier deletion for the sake of worse readability, actually. If the majority is for keeping your original solution, this is fine for me. I just like to understand the driver behind this.

Copy link
Contributor

@LanceAndersen LanceAndersen Nov 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the unlikely event there is an error, we can uniquely identify which file is left around more easily. Your proposed change ignores the IOException completely.

Given the size of the files, best to clean up before existing the test method.

Copy link
Contributor Author

@mkarg mkarg Nov 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should it be good for knowing which test left behind the temp file? As the code is not incorrect, you always would just delete all temp files of this test anyways - whether they are from the 2GB test or not. So this information helps you exactly nothing.

Your original code also ignored the IOException completely, so I do not understand that argument.

I do not see any benefit from immediate deletion vs deletion after ten seconds.

Those arguments are rather academic. I miss real benefit, actually.

test/jdk/java/nio/channels/Channels/TransferTo.java Outdated Show resolved Hide resolved
test/jdk/java/nio/channels/Channels/TransferTo.java Outdated Show resolved Hide resolved
@AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Nov 14, 2021

I don't think we need this. Instead, it would be better if the tests uses the test work directory so the files are easily found for post failure analysis. This isn't practical for the tests that create >2GB files so I think leave the code that Lance put in there to delete them so they aren't archived when the work directory is zipped up.

@mkarg
Copy link
Contributor Author

@mkarg mkarg commented Nov 14, 2021

I don't think we need this.

@AlanBateman @LanceAndersen You are confusing me. Lance requests style changes, while Alan does not want the changes. These answers are incompatible. Either I change the code according Lance's wishes, or we simple drop this PR. Please find a concensus.

@AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Nov 15, 2021

@AlanBateman @LanceAndersen You are confusing me. Lance requests style changes, while Alan does not want the changes. These answers are incompatible. Either I change the code according Lance's wishes, or we simple drop this PR. Please find a concensus.

I think it's better to pause a moment and understand the environment when jtreg runs tests. The important thing is that the current directory (as in user.dir) will be a scratch directory that jtreg has created. My comments are just pointing out that the bookkeeping proposed in this PR to delete files is not needed that you can just change the test to create the temp file in the current directory. We can leave the try-finally that Lance added in the >2GB tests because they are too big to keep for any post failure analysis.

@mkarg
Copy link
Contributor Author

@mkarg mkarg commented Nov 27, 2021

@AlanBateman @LanceAndersen You are confusing me. Lance requests style changes, while Alan does not want the changes. These answers are incompatible. Either I change the code according Lance's wishes, or we simple drop this PR. Please find a concensus.

I think it's better to pause a moment and understand the environment when jtreg runs tests. The important thing is that the current directory (as in user.dir) will be a scratch directory that jtreg has created. My comments are just pointing out that the bookkeeping proposed in this PR to delete files is not needed that you can just change the test to create the temp file in the current directory. We can leave the try-finally that Lance added in the >2GB tests because they are too big to keep for any post failure analysis.

Understood, so I will create the temp files in "." then and provide a reasonable prefix, keep the try-finally from Lance, and do not manually delete other temp files.

mkarg added 2 commits Nov 27, 2021
Signed-off-by: Markus Karg <markus@headcrashing.eu>
@openjdk openjdk bot removed the rfr label Nov 27, 2021
Signed-off-by: Markus Karg <markus@headcrashing.eu>
@openjdk openjdk bot added the rfr label Nov 27, 2021
@mkarg
Copy link
Contributor Author

@mkarg mkarg commented Nov 27, 2021

@AlanBateman IIUC then since b3719b7 this PR is now in the fashion that you proposed. Please correct me if I'm wrong.

@mkarg
Copy link
Contributor Author

@mkarg mkarg commented Dec 2, 2021

@AlanBateman @LanceAndersen I kindly request your review on this PR.

@mkarg
Copy link
Contributor Author

@mkarg mkarg commented Dec 2, 2021

I have integrated the changes we agreed upon from this PR into PR #5179, hence I hereby close this PR.

@mkarg mkarg closed this Dec 2, 2021
@mkarg mkarg deleted the tempfiles branch Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nio rfr
4 participants