On Fri, 17 Nov 2023 02:10:50 GMT, Patricio Chilano Mateo 
<pchilanom...@openjdk.org> wrote:

>> If it is a part of the `JvmtiEnvBase::is_vthread_alive()` then it is racy 
>> for mounted virtual threads.
>> It is not racy for unmounted virtual threads.
>
> So we should only see that a continuation is done for an unmounted vthread. 
> The last place where we could see a mounted vthread is at notifyJvmtiEnd(), 
> blocked in start_VTMS_transition(), but the continuation is not marked done 
> yet. 
> Also I realize the window for the problematic case I mentioned starts even 
> earlier at notifyJvmtiEnd(), not notifyJvmtiUnmount(), because blocking due 
> to JvmtiVTMSTransitionDisabler happens in start_VTMS_transition() not 
> finish_VTMS_transition(). Once the vthread executed notifyJvmtiEnd() any 
> JvmtiVTMSTransitionDisabler that happens afterwards will fall into this case. 
> So maybe the first sentence of the comment should instead be: "The vthread 
> could have already executed the last unmount but might not have changed state 
> to TERMINATED yet."

Thank you. Now I see that `done` is set to `true` during an unmount transition.
So, I'm convinced to move the check for 
`jdk_internal_vm_Continuation::done(cont)` to 
`JvmtiEnvBase::is_vthread_alive()`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16460#discussion_r1396695782

Reply via email to