-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8366298: FDLeakTest sometimes takes minutes to complete on Linux #26979
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back stefank! A progress list of the required criteria for merging this PR into |
@stefank This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. 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 35 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. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
@tstuefe Please comment if you have concerns about this change. Thanks |
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.
Thanks for looking at this. See comments inline.
int ret = getrlimit(RLIMIT_NOFILE, &rl); | ||
if (ret != 0) { | ||
return JNI_ERR; | ||
} |
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.
Hmm, if the JVM already has opened > 100 fds at this point, we get difficult to understand errors. Any future open etc call will fail.
What I would do is to check, after the call to fopen() at line 39, check for errno==EMFILE. If that is true, write out a clear error message along the lines of "more than 100 files open?" (since that in itself would be worth to investigate; this little test should not open > 100 files, but who knows).
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.
OK. I've added error logging for both setting the limit and opening the file. I didn't check specifically for EMFILE, but I hope that's fine?
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.
I also verified that if I set the limit to 3 I do get the "Too many open files" error message.
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.
Good, thanks!
Thanks for reviewing! |
While investigating JDK-8260555, which lowers the timeout factor from 4 to 1, we found that FDLeakTest sometimes times out on Linux.
The reason is that the test performs a
fcntl
call for each and every potential file descriptor number. This can be a large number of calls and sometimes results in minutes-long test executions.I propose that we fix this by limiting the max number of open file descriptors. This lowers the test execution time to about 1 second.
The test has two processes. One that executes the libFDLeaker.c code below as an agent in the test JVM, then it forks into a exeFDLeakTester.c, which reads the property
int max_fd = (int)sysconf(_SC_OPEN_MAX);
. The setting ofRLIMIT_NOFILE
to100
lowersmax_fd
to100
. I've verified this on both Linux and on macOS.I've run the test manually on Linux and macOS and verified that it runs faster. I've also run this through tier1.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26979/head:pull/26979
$ git checkout pull/26979
Update a local copy of the PR:
$ git checkout pull/26979
$ git pull https://git.openjdk.org/jdk.git pull/26979/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26979
View PR using the GUI difftool:
$ git pr show -t 26979
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26979.diff
Using Webrev
Link to Webrev Comment