RFR: 8355631: The events might be generated after VM_DEATH event [v2]
Leonid Mesnik
lmesnik at openjdk.org
Sat Oct 25 18:13:44 UTC 2025
> The JVMTI spec says: https://docs.oracle.com/en/java/javase/24/docs/specs/jvmti.html#VMDeath
> `The VM death event notifies the agent of the termination of the VM. No events will occur after the VMDeath event.`
>
> However, current implementation changes state and only after this start disabling events.
>
> It might be not a conformance issue, because there is no way to get thread state in the very beginning of event.
> The main practical issue is that currently certain events are generated when VM is becoming dead. So any function in event should check error against JVMTI_PHASE_DEAD. We can easily trigger it by running tests with enabled https://bugs.openjdk.org/browse/JDK-8352654
>
> Also, it would be useful to guarantee that VM_DEATH is last event so users can safely close/destroy all supported all structures used by Jvmti agent (like RawMonitors).
>
> The proposed fix is to stop events posting and wait for already executing events before vm_death is posted.
>
> Currently, I haven't seen problems with this fix and https://bugs.openjdk.org/browse/JDK-8352654.
Leonid Mesnik has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 23 additional commits since the last revision:
- fixed comments
- fixed comments
- cleanup
- The global flag implemented
- the post compiled method updated
- added antoher transition
- Merge branch 'master' of https://github.com/openjdk/jdk into 8355631
- better sync
- restore eventmark
- Revert "removed unused field"
This reverts commit 379991eca4e54e1990ba2ade3d9a5c53d1f3657c.
- ... and 13 more: https://git.openjdk.org/jdk/compare/c205be47...35b7c647
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/27504/files
- new: https://git.openjdk.org/jdk/pull/27504/files/b71ee9b9..35b7c647
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=27504&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=27504&range=00-01
Stats: 163338 lines in 1904 files changed: 135305 ins; 18271 del; 9762 mod
Patch: https://git.openjdk.org/jdk/pull/27504.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27504/head:pull/27504
PR: https://git.openjdk.org/jdk/pull/27504
More information about the serviceability-dev
mailing list