Skip to content

8352773: JVMTI should disable events during java upcalls #24539

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

Closed
wants to merge 4 commits into from

Conversation

sspitsyn
Copy link
Contributor

@sspitsyn sspitsyn commented Apr 9, 2025

As noted in JDK-8352088, JVMTI GetThreadGroupChildren does an upcall to java. This results in aClassPrepare event the first time it does this, and these events can cause problems (deadlocks) for the debugger or debug agent. The JDK-8352088 was fixed to get rid of class loading during Java upcall from GetThreadGroupChildren. However, some other events can be generated as well. It is more safe to disable all JVMTI events during debugger-related upcalls originated by JVMTI.
The ClassPrepare events are important for the debug agent. So, an assert was added into ClassPrepare event generation to make sure there are no attempts to post this event during upcalls.
Some specific implementation details can be added to the first PR comment.

Testing:

  • Verified with the test jdk/com/sun/jdi/EarlyThreadGroupChildrenTest.java that was added with the fix of JDK-8352088:
    • the assert described above is fired if the fix of JDK-8352088 is removed
    • the test is passed without if the fix of JDK-8352088 is removed and the assert is removed
  • Ran mach5 tiers 1-6

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8352773: JVMTI should disable events during java upcalls (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24539/head:pull/24539
$ git checkout pull/24539

Update a local copy of the PR:
$ git checkout pull/24539
$ git pull https://git.openjdk.org/jdk.git pull/24539/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24539

View PR using the GUI difftool:
$ git pr show -t 24539

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24539.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 9, 2025

👋 Welcome back sspitsyn! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 9, 2025

@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:

8352773: JVMTI should disable events during java upcalls

Reviewed-by: lmesnik, dholmes, cjplummer, coleenp

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 86 new commits pushed to the master branch:

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 9, 2025
@openjdk
Copy link

openjdk bot commented Apr 9, 2025

@sspitsyn The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Apr 9, 2025

Webrevs

@AlanBateman
Copy link
Contributor

If this goes ahead then it allows for a discussion about changing JVMTI InterruptThread to invoke Thread.interrupt when the target is a platform thread. As you know, there is a long standing issue here where threads blocked on interruptible channels not being awakened by JVMTI InterruptThread.

@sspitsyn
Copy link
Contributor Author

sspitsyn commented Apr 9, 2025

If this goes ahead then it allows for a discussion about changing JVMTI InterruptThread to invoke Thread.interrupt when the target is a platform thread. As you know, there is a long standing issue here where threads blocked on interruptible channels not being awakened by JVMTI InterruptThread.

Yes, this fix is already including an update for interrupts. I'll add a comment with the fix details tomorrow.

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is another case where you have to ignore JVMTI event like in VTMS transitions? It looks like a good way to fix this in general.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 9, 2025
Copy link
Member

@lmesnik lmesnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@sspitsyn
Copy link
Contributor Author

sspitsyn commented Apr 9, 2025

Coleen and Leonid, thank you for review!

@sspitsyn
Copy link
Contributor Author

sspitsyn commented Apr 9, 2025

So this is another case where you have to ignore JVMTI event like in VTMS transitions? It looks like a good way to fix this in general.

Yes. This is a long standing issue which is good to fix now.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Apr 9, 2025
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me. Thanks.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 10, 2025
@sspitsyn
Copy link
Contributor Author

David, thank you for review!

@sspitsyn
Copy link
Contributor Author

I've pushed a minor update to fix a build time error for minimal VM.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Apr 10, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 10, 2025
@sspitsyn
Copy link
Contributor Author

Chris, thank you for review! Thank you for re-approvals guys!

@sspitsyn
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Apr 11, 2025

Going to push as commit 1c34f3c.
Since your change was applied there have been 90 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 11, 2025
@openjdk openjdk bot closed this Apr 11, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 11, 2025
@openjdk
Copy link

openjdk bot commented Apr 11, 2025

@sspitsyn Pushed as commit 1c34f3c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@sspitsyn sspitsyn deleted the c10 branch April 11, 2025 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

6 participants