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
8295816: jdwp jck tests failing with "FATAL ERROR in native method: JDWP SetTag, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)" #10831
Conversation
👋 Welcome back cjplummer! A progress list of the required criteria for merging this PR into |
@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. |
if (error != JVMTI_ERROR_NONE) { | ||
EXIT_ERROR(error,"signature"); | ||
} | ||
|
||
if (gdata && gdata->assertOn) { | ||
if (gdata->assertOn) { |
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.
Just a question.
Why the check for non-NULL gdata was removed?
Is it because gdate is always non-NULL?
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.
It's created during the OnLoad and never freed, so it can never be null once this callback is setup.
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 workaround looks okay to me.
I hope it solves the problem observed with the JCK tests.
In fact, we sometimes keep forgetting to run JCK tests. 👍
Thanks,
Serguei
@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 35 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 |
Yes, but it's also turning up with some JDI tests. I did a lot of testing, and have done a bunch since for other changes I'm working on, and this never turned up. I did get it to turn up once yesterday after doing about 100 jck runs. However, it seems to be turning up a lot more than that in our CI runs. I'm not sure why. |
Thanks for the review Serguei! Can I get one more review please. The failures are getting rather noisy, so I'd like to get this fix pushed. Thanks. |
If you think that this fix will resolved both JDK-8295815 and JDK-8295816, then |
/issue JDK-8295815 |
@plummercj |
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 adding is_wrong_phase() with the comments about
why it is okay. The deletion of the 'gdata != NULL' check also
caught my eye, but I'm getting more and more convinced that
it's okay to catch this kind of "can't happen" error via the deref
of the pointer that shouldn't be NULL...
Thumbs up.
Thanks for the reviews! /integrate |
Going to push as commit fec6174.
Your commit was automatically rebased without conflicts. |
@plummercj Pushed as commit fec6174. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Various debugger tests (mainly JCK vm/jdwp tests) are failing with:
FATAL ERROR in native method: JDWP SetTag, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)
Sometimes instead of
SetTag
the message saysGetTag
orsignature
. This is a new issue caused by JDK-8295375, which changed the debug agent CLASS_PREPARE event handling that is used for class tracking. It moved it from the main debug agent JVMTIEnv to a JVMTIEnv that already existed for class tracking purposes to deal with OBJECT_FREE events. Because of this, synchronizing around VMDEATH was lost, so it's possible for the CLASS_PREPARE event to be received just before VMDEATH, but then VMDEATH completes before the CLASS_PREPARE callback can complete. This results in WRONG_PHASE errors when making some JVMTI calls.The easiest fix is for the code in
classTrack_addPreparedClass()
to check for JVMTI_ERROR_WRONG_PHASE, and if it gets it then just return. It should also assert thatgData->vmDead
is true when this happens. This is needed in 3 places where JVMTI is called.The purist fix would be to somehow synchronize with VMDEATH, either with the same locking done by the main event handling code (for example, use BEGIN_CALLBACK and END_CALLBACK), or by having the class tracking JVMTIEnv also enable VMDEATH events. The VMDEATH callback block would disable the CLASS_PREPARE events, and also block until any currently executing CLASS_PREPARE callback has exited. I think this is overkill, and also adds locking overhead to the CLASS_PREPARE callback, so I'm going with the simpler solution of allowing WRONG_PHASE.
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10831/head:pull/10831
$ git checkout pull/10831
Update a local copy of the PR:
$ git checkout pull/10831
$ git pull https://git.openjdk.org/jdk pull/10831/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10831
View PR using the GUI difftool:
$ git pr show -t 10831
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10831.diff