-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
8332154: Memory leak in SynchronousQueue #19271
Conversation
👋 Welcome back vklang! A progress list of the required criteria for merging this PR into |
@viktorklang-ora 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 77 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 |
@viktorklang-ora 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
|
@AlanBateman @DougLea Reviews are most welcome :) |
@viktorklang-ora We managed to reproduce it quite reliably by running the test from the bug report multiple times (in our case, it was 100). I understand this does not make a 100% stable regression reproducer, but in case of multiple runs the probability of false positive in quite low. |
Hi @viktorklang-ora
When the test is launched 100 times it is guaranteed to fail in at least one iteration. With this fix no failures were detected in 1000 runs. |
Looks good; thanks. I don't know why I left out this check in a case that is otherwise identical to LTQ. |
…d runs only for JDK20+, using VirtualThreads
@DougLea I decided to move to using VirtualThreads and therefor pulling the memory leak test out into its own class which only runs for JDK20+. |
Sure. Seems reasonable. |
@DougLea Perfect, thanks for reviewing! 👍 |
Looks okay, I just wonder how reliable assertDoesntLeak with concurrent agents, debug builds, and VM options such as a Xcomp that will challenge the await(10s). Minimally the timed awaits should be untimed. Another idea is try an ES like this:
No need for the count down latches or the need to retry on InterruptedException. The close method waits for the 400 virtual threads to finish so you can assert that the queue is empty. The loop that waits for survivors to empty can be unbounded too. If there is a leak then the test will timeout. |
@AlanBateman Great suggestions, Alan. I've updated the PR to reflect your improvements. |
/integrate |
Going to push as commit b78613b.
Your commit was automatically rebased without conflicts. |
@viktorklang-ora Pushed as commit b78613b. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
@knisht @vprovodin Thanks for the thoughts, I decided to go for a blackbox test to make sure that this test does not rely on any internal impl details of SynchronousQueue. |
Local testing seems to indicate that this fix (which mirrors what's done in the FIFO mode) addresses the problem. Regression test added for JDK20+
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19271/head:pull/19271
$ git checkout pull/19271
Update a local copy of the PR:
$ git checkout pull/19271
$ git pull https://git.openjdk.org/jdk.git pull/19271/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19271
View PR using the GUI difftool:
$ git pr show -t 19271
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19271.diff
Webrev
Link to Webrev Comment