RFR: 8297170: misc JCK tests fail with "FATAL ERROR in native method: JDWP Can't disable vthread end events, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)"
Chris Plummer
cjplummer at openjdk.org
Wed Nov 23 02:30:50 UTC 2022
[JDK-8295376](https://bugs.openjdk.org/browse/JDK-8295376) introduced some new code that disables JVMTI VIRTUAL_THREAD_START/END events when the debugger disconnects. Sometimes this disabling attempt results in a JVMTI_ERROR_WRONG_PHASE. The reason is because often the disconnect and debuggee exit are happening at the same time. By the time the disable is attempted, the VM has already sent (and the debug agent processed) the VM_DEATH event, so the VM is now in JVMTI_PHASE_DEAD.
To fix this I took the direct approach of just allowing JVMTI_ERROR_WRONG_PHASE if VM_DEATH has been sent already. I could have tried something more elegant that would have synchronized on the vmDeathLock, and avoided the disabling call completely, but I didn't think the risk of a deadlock was worth it, so I kept it simple.
-------------
Commit messages:
- Allow PHASE_ERROR when disabling vthread events
Changes: https://git.openjdk.org/jdk/pull/11307/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11307&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8297170
Stats: 14 lines in 1 file changed: 11 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/11307.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11307/head:pull/11307
PR: https://git.openjdk.org/jdk/pull/11307
More information about the serviceability-dev
mailing list