-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8364314: java_lang_Thread::get_thread_status fails assert(base != nullptr) failed: Invalid base #26544
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
…lptr) failed: Invalid base
👋 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 56 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. |
Webrevs
|
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 reasonable.
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. I have a single typo and a suggested rewording for a comment.
In src/hotspot/share/jfr/jni/jfrJavaSupport.cpp, the static However, both |
For the calls to will allow the carrier JavaThread to be returned to the caller. I don't know if this is an issue or not. |
In src/hotspot/share/prims/whitebox.cpp, we have three functions:
that call I'm not sure who to ping for answering this query. |
@dholmes-ora - I went back and took a wider look at all the code that calls I think for fixing the crash that we're seeing in the CI, this fix is good to go, |
I just finished catching up on this other issue/PR: JDK-8361103 java_lang_Thread::async_get_stack_trace does not properly protect JavaThread And this comment from @sspitsyn stuck out to me w.r.t. to this fix:
The above comment from Serguei calls into question this suggested change that I posted on the PR: https://github.com/openjdk/jdk/pull/26544/files#r2243188114 If the JvmtiVTMSTransitionDisabler only works when there's an agent attached, |
Right. The issue was discovered several weeks ago: https://bugs.openjdk.org/browse/JDK-8361913 Work in progress |
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 to me.
Those two methods should only be called for platform threads. |
Currently these are only used in tests with platform threads. If we would pass a virtual thread as argument, then in those cases you mentioned we would read/print the state of some other thread in the handshake closure, but there shouldn’t be a crash. |
Also, I think a |
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 is a reasonable safety fix. Looks good to me modulo comment wording which is being disussed.
I've pushed some initial changes to the loom repo to deal with the transitions. This drops the use of JvmtiVTMSTransitionDisabler as this requires a JVMTI environment. We have a new stress too that bashes on dumpThreads while many virtual threads are parking and unparking. Need to go over this with @alexmenkov and @sspitsyn before proposing anything for main line. |
@dcubed-ojdk I had already examined all the other clients of |
Thanks for the reviews @shipilev , @dcubed-ojdk , @pchilano and @sspitsyn . As noted above this particular code is problematic for a range of reasons, but for now this fix maintains the pretense that the transition disabler actually works, and @AlanBateman will be fixing that as noted above. Other clients of Thanks again for the reviews. If someone could re-review the comment changes that would be appreciated. Thanks. |
Yes, get_thread_snapshot has a bug tail. Longer term we need to put in infrastructure to interact with a specific virtual thread or all virtual threads. We need this for a second phase of thread dump anyway. Short term we can use the same approach as Thread::getStackTrace by suspending the virtual thread when unmounted, have the handshake op check that the virtual thread and continuation is mounted, and retry if attempting a snapshot during a transition. I've put a possible change in this draft PR - I need to discuss with Serguei and Alex on how they want to handle this. |
Thanks for the re-review @alexmenkov ! /integrate |
Going to push as commit 84a4a36.
Your commit was automatically rebased without conflicts. |
@dholmes-ora Pushed as commit 84a4a36. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
After the changes in JDK-8361912 we could "return " the carrier thread from
cv_internal_thread_to_JavaThread
, but before we hit the transition disabler the virtual thread could unmount. As a result when we execute this code:we hit the implicit else where "
carrier_thread == nullptr
" and we do nothing, butjava_thread
still holds the old carrier, which we then perform the handshake operation with:But the
_java_thread
no longer has a carrier, soget_thread_status
is passed null and we crash.Simple fix is to clear
java_thread
when we find a null carrier oop. Also added an assert to guard against a null carrier oop in the handshake code, and added some additional commentary.Testing:
Thanks
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26544/head:pull/26544
$ git checkout pull/26544
Update a local copy of the PR:
$ git checkout pull/26544
$ git pull https://git.openjdk.org/jdk.git pull/26544/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26544
View PR using the GUI difftool:
$ git pr show -t 26544
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26544.diff
Using Webrev
Link to Webrev Comment