On Wed, 23 Nov 2022 02:22:46 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
> [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. This pull request has now been integrated. Changeset: 1323e98d Author: Chris Plummer <cjplum...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/1323e98df14f16310ca1349db198ee17409cda49 Stats: 14 lines in 1 file changed: 11 ins; 0 del; 3 mod 8297170: misc JCK tests fail with "FATAL ERROR in native method: JDWP Can't disable vthread end events, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)" Reviewed-by: amenkov, dcubed, lmesnik, sspitsyn ------------- PR: https://git.openjdk.org/jdk/pull/11307