On Thu, 16 Nov 2023 22:44:12 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:

>> Sounds good. Is there a reason why not have the check inside 
>> JvmtiEnvBase::is_vthread_alive()?
>
> 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."

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

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

Reply via email to