-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8290200: com/sun/jdi/InvokeHangTest.java fails with "Debuggee appears to be hung" #13068
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
Conversation
👋 Welcome back cjplummer! A progress list of the required criteria for merging this PR into |
@@ -214,7 +220,7 @@ protected void runTests() throws Exception { | |||
targetClass = bpe.location().declaringType(); | |||
mainThread = bpe.thread(); | |||
EventRequestManager erm = vm().eventRequestManager(); | |||
final Thread mainThread = Thread.currentThread(); | |||
final Thread mainTestThread = Thread.currentThread(); |
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.
This local variable was conflicting with an instance field of the same name. See line 135. I ran into issues when I added some debugging code to this method that referenced the other mainThread
, so I did a rename.
@plummercj 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
|
@@ -191,7 +197,7 @@ public void breakpointReached(BreakpointEvent event) { | |||
ThreadReference thread = event.thread(); | |||
try { | |||
StackFrame sf = thread.frame(0); | |||
System.err.println(" Debugger: Breakpoint hit at "+sf.location()); | |||
System.out.println(" Debugger: Breakpoint hit at "+sf.location()); |
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.
while you are here please add spaces around plus
@plummercj 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 69 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 |
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.
Looks good.
Thanks,
Serguei
try { | ||
t1.join(); | ||
t2.join(); | ||
} catch (InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} |
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.
Please consider adding a comment that explains that the join()
calls
are only necessary when t1
and t2
are virtual threads.
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.
Thumbs up. Thanks for adding the comment.
One possible nit typo...
|
||
try { | ||
// The join ensures that the test completes before we exit main(). If we are using | ||
// virtual threads, they are always daemon threads, and therefor the JVM will exit |
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.
nit typo: s/therefor/therefore/
/integrate |
Going to push as commit 0deb648.
Your commit was automatically rebased without conflicts. |
@plummercj Pushed as commit 0deb648. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The debuggee main method creates two threads and then starts them:
These threads will hit breakpoints which the debugger handles and issues an invoke on the breakpoint thread. The threads run until they generate 100 breakpoints. There is an issue when these two threads are virtual threads. Virtual threads are daemon threads. That means the JVM can exit while they are still running. The above main() method is not waiting for these two threads to exit, so main() exits immediately and the JVM starts the shutdown process. It first must wait for all non-daemon threads to exit, but there are none, so the JVM exits right away before the two threads are completed. The end result of this early exit is that sometimes the invoke done by the debugger never completes because the JVM has already issued a VMDeath event and the debuggee has been disconnected.
When these two threads are platform threads, the JVM has to wait until they complete before it exits, so they will always complete. The fix for virtual threads is to do a join with t1 and t2. This forces the main() method to block until they have completed.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/13068/head:pull/13068
$ git checkout pull/13068
Update a local copy of the PR:
$ git checkout pull/13068
$ git pull https://git.openjdk.org/jdk pull/13068/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13068
View PR using the GUI difftool:
$ git pr show -t 13068
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13068.diff