-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8335836: serviceability/jvmti/StartPhase/AllowedFunctions/AllowedFunctions.java fails with unexpected exit code: 112 #20397
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
…tions.java fails with unexpected exit code: 112
👋 Welcome back sspitsyn! A progress list of the required criteria for merging this PR into |
@sspitsyn 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 53 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 |
Webrevs
|
Converting the native agent to C++ would simplify the test and allow to use utility functions from the |
// Block VMDeath event and other ClassPrepare events while this callback is executed. | ||
// Sync with VMDeath event guards agains JVMTI_ERROR WRONG_PHASE. | ||
err = (*jvmti)->RawMonitorEnter(jvmti, event_mon); |
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 don't see how this fixes the problem. You can be exiting VMDeath when this monitor is entered. This does not block the get_thread_local() call below, which is what leads to the WRONG_PHASE. I think using a raw monitor is the right approach, but I was expecting to see VMDeath set a flag after grabbing the monitor that indicated VMDeath had been called. Then ClassPrepare should check this flag after grabbing the monitor and ignore the event if it is set.
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.
Thank you for the comment.
Fixed the get_thread_local()
issue and corrected phase check.
New flag is not really needed as the phase == JVMTI_PHASE_DEAD
can play its role.
Please, let me know if you are not okay with that.
jvmtiError err; | ||
|
||
// Block VMDeath event and other ClassPrepare events while this callback is executed. | ||
// Sync with VMDeath event guards agains JVMTI_ERROR WRONG_PHASE. |
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.
// Sync with VMDeath event guards agains JVMTI_ERROR WRONG_PHASE. | |
// Sync with VMDeath event guards agains JVMTI_ERROR_WRONG_PHASE. |
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.
Fixed now, thanks!
|
||
get_phase(jvmti, &phase); | ||
if (phase != JVMTI_PHASE_START && phase != JVMTI_PHASE_LIVE) { | ||
printf(" ## Error: unexpected phase: %d, expected: %d or %d\n", | ||
phase, JVMTI_PHASE_START, JVMTI_PHASE_LIVE); | ||
if (phase != JVMTI_PHASE_DEAD) { |
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.
After this check is made, what prevents JVMTI from moving to the JVMTI_PHASE_DEAD before the get_cur_thread() call below? I'm not sure if the phase is changed to JVMTI_PHASE_DEAD before or after calling VMDeath, but it seems in either case you can end up with the phase changing after making this check. There is nothing that stops the phase from changing while holding the raw monitor.
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, Chris.
The JvmtiExport::post_vm_death()
posts the VMDeath
before changing the phase to JVMTI_PHASE_DEAD
.
The VMDeath
callback is blocked on the RawMonitor
while it is grabbed by the ClassPrepare
event callback.
But you are right, there is a sync gap in JvmtiExport::post_vm_death()
between the VMDeath
callback execution and phase changing. So, I'll go with your suggestion and introduce a flag.
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.
Added is_vm_dead
flag.
|
||
if (is_vm_dead == JNI_TRUE) { |
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.
if (is_vm_dead == JNI_TRUE) { | |
if (is_vm_dead) { |
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, updated now.
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.
Thank you for review, Chris! |
Thank you for review, Alex! |
/integrate |
Going to push as commit 965d6b9.
Your commit was automatically rebased without conflicts. |
The test has been fixed to:
exit(err)
withabort()
in thecheck_jvmti_error()
The JVMTI
VMDeath
event is enabled and aRawMonitor
is introduced to serializeClassPrepare
andVMDeath
events, and so, to prevent JVMTI_ERROR_WRONG_PHASE in theClassPrepare
events.Testing:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20397/head:pull/20397
$ git checkout pull/20397
Update a local copy of the PR:
$ git checkout pull/20397
$ git pull https://git.openjdk.org/jdk.git pull/20397/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20397
View PR using the GUI difftool:
$ git pr show -t 20397
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20397.diff
Webrev
Link to Webrev Comment