-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8308043: Deadlock in TestCSLocker.java due to blocking GC while allocating #13989
Conversation
👋 Welcome back eosterlund! A progress list of the required criteria for merging this PR into |
Webrevs
|
@fisk 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 22 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 |
@@ -51,7 +51,6 @@ public static void main(String args[]) throws Exception { | |||
|
|||
// check timeout to success deadlocking | |||
while(System.currentTimeMillis() < startTime + timeout) { | |||
System.out.println("sleeping..."); |
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 think some comments (one cannot run any gc-triggering code, e.g. println) here would be nice. It's super tempting to add some innocent debug-prints before suspending the current thread, while extending/fixing this test case in the future.
@@ -51,7 +51,6 @@ public static void main(String args[]) throws Exception { | |||
|
|||
// check timeout to success deadlocking | |||
while(System.currentTimeMillis() < startTime + timeout) { |
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.
In addition to @albertnetymk's comment, please also fix the whitespace after the while
and the bracket.
Thanks for the reviews @stefank @tschatzl and @albertnetymk! I updated with a comment and whitespace fix as suggested, and removed an old problem listing for this test. |
/integrate |
Going to push as commit 285c833.
Your commit was automatically rebased without conflicts. |
The TestCSLocker.java test spawns a thread that grabs the GC locker, and then wait for the first thread to run some java code and then get signal back to release the GC locker. All of this while another thread is allocating garbage and triggering GCs. Naturally, if the thread that is to signal the release of the GC locker requires GC in order to make progress, we will end up with a deadlock that leads to a timeout. As it turns out, that does indeed happen. A println statement is performed, which in its internal implementation performs an allocation, which requires GC. I think any GC can spuriously fail here, but it seems more likely with generational ZGC for whatever reason. While it seems really shady to wait with the GC locker held while a Java thread executing Java code is supposed to make progress, in general, I think the test can be fixed by removing the println statement causing the allocation. I have run the test 200 times, and it's no longer failing with generational ZGC.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13989/head:pull/13989
$ git checkout pull/13989
Update a local copy of the PR:
$ git checkout pull/13989
$ git pull https://git.openjdk.org/jdk.git pull/13989/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13989
View PR using the GUI difftool:
$ git pr show -t 13989
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13989.diff
Webrev
Link to Webrev Comment