RFR: 8352773: JVMTI should disable events during java upcalls [v2]

Serguei Spitsyn sspitsyn at openjdk.org
Wed Apr 9 22:41:05 UTC 2025


> As noted in [JDK-8352088](https://bugs.openjdk.org/browse/JDK-8352088), JVMTI `GetThreadGroupChildren` does an upcall to java. This results in  a`ClassPrepare` event the first time it does this, and these events can cause problems (deadlocks) for the debugger or debug agent. The  [JDK-8352088](https://bugs.openjdk.org/browse/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](https://bugs.openjdk.org/browse/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

Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision:

  review: 1) added an assert for ClassLoad events same as for ClassPrepare; 2) added one minor comment

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/24539/files
  - new: https://git.openjdk.org/jdk/pull/24539/files/82e99fae..342e8a78

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24539&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24539&range=00-01

  Stats: 5 lines in 2 files changed: 4 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/24539.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24539/head:pull/24539

PR: https://git.openjdk.org/jdk/pull/24539


More information about the hotspot-dev mailing list