On Thu, 4 Dec 2025 04:23:29 GMT, Leonid Mesnik <[email protected]> wrote:
>> During the debugger disconnect we free all ThreadNodes for vthreads. Part of
>> doing this includes calling JVMTI SetThreadLocalStorage(thread, NULL). It's
>> possible that after the disconnect process has already started the VM starts
>> to exit (resulting in a VMDeath event). Once this happens
>> SetThreadLocalStorage will start to return JVMTI_ERROR_WRONG_PHASE. We
>> should ignore this error rather than having it result in an fatal error for
>> the debug agent.
>>
>> Tested with tier1, all tier5 svc testing, and ran vmTestbase/nsk/jdi 10
>> times on linux-aarch64-debug, which is the only platform that has seen this
>> failure so far.
>
> src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c line 173:
>
>> 171: }
>> 172: }
>> 173: if (error == JVMTI_ERROR_WRONG_PHASE && gdata->vmDead &&
>> isVThread(thread)) {
>
> Shouldn't be check for any daemon threads and not only virtual?
It's only possible to end up in this situation with vthreads. That's because
when the debugger disconnects, we free all the ThreadNodes for vthreads. We
don't do that for platform threads or non-java threads. threadControl_reset()
is calling removeVThreads() when this issue turns up. There is no equivalent
for other thread types.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28653#discussion_r2587580289