RFR: 8361912: ThreadsListHandle::cv_internal_thread_to_JavaThread does not deal with a virtual thread's carrier thread [v2]
Serguei Spitsyn
sspitsyn at openjdk.org
Thu Jul 24 15:47:55 UTC 2025
On Thu, 24 Jul 2025 12:31:04 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> The java_thread can be null because the carrier of a mounted vthread was not contained in the ThreadsListHandle.
>>
>> The only thing this function guarantees is that if the vthread appeared to have a carrier and that carrier is protected by the TLH, then the caller can safely interact with the carrier knowing it can't terminate - same as for regular threads. The caller has to account for the potential async mounting/unmounting of vthread - e.g. by handshaking the reported carrier and then confirming it is still the carrier.
>
> Note that `java_thread` may already be null so we don't get to execute line 836.
Thanks, David. The potential issue I'm still concerned about is that a subsequent handshaking can observe the JavaThread (and virtual thread as well) in a VTMS transition when there is no protection with a `VTMSTransitionDisabler`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26287#discussion_r2228896900
More information about the hotspot-dev
mailing list