-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8274687: JDWP deadlocks if some Java thread reaches wait in blockOnDebuggerSuspend #5849
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
8274687: JDWP deadlocks if some Java thread reaches wait in blockOnDebuggerSuspend #5849
Conversation
👋 Welcome back rrich! A progress list of the required criteria for merging this PR into |
b59d303
to
8c1b5ce
Compare
Webrevs
|
@reinrich 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 441 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.
Hi Richard,
The fix looks okay to me.
I've inlined one minor suggestion.
Thanks,
Serguei
*/ | ||
debugMonitorExit(threadLock); | ||
eventHandler_lock(); | ||
debugMonitorEnter(threadLock); |
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.
The lines 2192-2194 look like a hack to me.
But I see you have filed an enhancement to fix this.
I'm okay to address it later.
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 Serguei.
I agree that this part looks a little odd. It is still correct, though, and the changes are limited to the hardly used code responsible for handling j.l.Thread.resume() calls which is a good thing IMHO.
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.
LGTM
Thanks for the reviews @plummercj, @sspitsyn, @schmelter-sap! /integrate |
Going to push as commit ca2efb7.
Your commit was automatically rebased without conflicts. |
This change fixes deadlocks described in the JBS-bug by:
Releasing
handlerLock
before waiting onthreadLock
inblockOnDebuggerSuspend()
Notifying on
threadLock
inthreadControl_reset()
Also the actions in handleAppResumeBreakpoint() are moved/deferred until
doPendingTasks() runs. This is necessary because an event handler must not
release handlerLock first and foremost because handlers are called while
iterating the handler chain for an event type which is protected by handlerLock
(see #5805)
The first commit delays the cleanup actions after leaving the loop in
debugLoop_run()
. It allows to reproduce the deadlock running the dispose003test with the command
The second commit adds a new test that reproduces the deadlock when calling
threadControl_resumeThread() while a thread is waiting in
blockOnDebuggerSuspend().
The third commit contains the fix described above. With it the deadlocks
cannot be reproduced anymore.
The forth commit removes the diagnostic code introduced with the first commit again.
The fix passed
test/hotspot/jtreg/serviceability/jdwp
test/jdk/com/sun/jdi
test/hotspot/jtreg/vmTestbase/nsk/jdwp
test/hotspot/jtreg/vmTestbase/nsk/jdi
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5849/head:pull/5849
$ git checkout pull/5849
Update a local copy of the PR:
$ git checkout pull/5849
$ git pull https://git.openjdk.java.net/jdk pull/5849/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5849
View PR using the GUI difftool:
$ git pr show -t 5849
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5849.diff