8369515: Deadlock between JVMTI and JNI ReleasePrimitiveArrayCritical#28779
8369515: Deadlock between JVMTI and JNI ReleasePrimitiveArrayCritical#28779dholmes-ora wants to merge 5 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back dholmes! A progress list of the required criteria for merging this PR into |
|
@dholmes-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 52 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 |
|
@dholmes-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. |
|
/label add hotspot-runtime |
|
@dholmes-ora |
|
@dholmes-ora |
Webrevs
|
|
Thanks for providing a fix for the issue David. |
|
@dholmes-ora I do think that also entering a critical region is problematic if it is nested. |
Isn't nesting critical regions against the rules of using critical regions? |
For arrays it's explicitly allowed in the specification. There's also an example how to do it properly :) |
Right I see that. It states:
but then explicitly allows the critical functions themselves to be an exception. Okay. So isn't a fix for this simply to skip blocking as per your PR: irrespective of nesting and without any need for any of the changes I proposed? |
Yes, I currently think so. |
This reverts commit 3beb23c.
|
I tested tiers 1-6 with the simplified fix and nothing has turned up. |
|
Thanks! Same with my testing. |
|
/contributor add @reinrich |
|
@dholmes-ora |
fbredber
left a comment
There was a problem hiding this comment.
Fixing deadlock issues caused by suspend requests can easily become quite messy, but not this time. I think it's an elegant solution, with a good explaining source code comment. Thank you!
|
FTR we are not processing this special exit condition when transitioning from |
|
I wonder why there are no GHA tests? |
I don't run GHA by default. |
|
A deadlock can still occur if the debugger suspends the thread in the critical region, e.g. to read a local variable. After JDK-8373839 this shouldn't be possible anymore. |
reinrich
left a comment
There was a problem hiding this comment.
Looks good.
Thanks, Richard.
|
Thanks for the reviews! /integrate |
|
Going to push as commit 25e8714.
Your commit was automatically rebased without conflicts. |
|
@dholmes-ora Pushed as commit 25e8714. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
As discussed in JBS the deadlock occurs when the call to
ReleasePrimitiveArrayCriticalperforms the transition from native to VM, and in the process checks for special runtime exit conditions - which includes theobj_deopt_suspendrequest. The simple solution is to define a custom JNI ENTRY with customThreadInVMfromNativethat elides the exit check.The change is limited to
ReleasePrimitiveArrayCriticalandReleaseStringCritical.UPDATE: we are now employing a much simpler solution.
There is no regression test as this has only been seen in long running stress tests.
Testing:
-tiers 1-6
Progress
Issue
Reviewers
Contributors
<rrich@openjdk.org>Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28779/head:pull/28779$ git checkout pull/28779Update a local copy of the PR:
$ git checkout pull/28779$ git pull https://git.openjdk.org/jdk.git pull/28779/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28779View PR using the GUI difftool:
$ git pr show -t 28779Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28779.diff
Using Webrev
Link to Webrev Comment