RFR: 8361912: ThreadsListHandle::cv_internal_thread_to_JavaThread does not deal with a virtual thread's carrier thread [v2]
David Holmes
dholmes at openjdk.org
Thu Jul 24 20:37:54 UTC 2025
On Thu, 24 Jul 2025 17:35:23 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> Thanks, David. The potential issue I'm still concerned about is that a subsequent handshaking can also observe the JavaThread (and virtual thread as well) in a VTMS transition when there is no protection with a `VTMSTransitionDisabler`.
>
>> Note that java_thread may already be null so we don't get to execute line 836.
>
> Right. I guess, this answers my comment about the line 839.
Once in the handshake the carrier (and thus virtual thread) is "frozen" with regards to any transition. It could be anywhere in the process of mounting/unmounting (depending of course exactly where the carrier might respond to the handshake request), and the actual handshake operation has to deal with that. But that is true no matter how you extracted a reference to the carrier. As I said before the only thing this change guarantees is that the carrier is protected by the TLH and can't fully terminate whilst handshaking with it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26287#discussion_r2229522833
More information about the hotspot-dev
mailing list