RFR: 8361103: java_lang_Thread::async_get_stack_trace does not properly protect JavaThread [v4]
Alan Bateman
alanb at openjdk.org
Thu Jul 17 06:17:51 UTC 2025
On Thu, 17 Jul 2025 02:01:24 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> If transition disabling is only available with JVMTI then I think we have a significant problem trying to deal with virtual threads in a number of APIs. Without disabling transitions you would basically need a loop that safely extracts the current carrier, handshakes with it, checks the VT is still mounted, and if not repeat the process. At the moment it appears that if the carrier is seen to have changed then we can just skip the VT - which would be very wrong IMO for most APIs e.g. thread dumps.
>
>> please, note that the JvmtiVTMSTransitionDisabler mechanism is enabled only when there is a JVMTI agent.
>
> @sspitsyn can you clarify this please. When you take a thread dump via the HotsotDiagnosticMXBean is there a JVMTI agent involved? Because that code uses the transition disabler.
Thread::getStackTrace handles this with a SUSPEND bit and loop. I think the only non-JVMTI API where we've got an issue right now is HotsotDiagnosticMXBean.dumpThreads.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26119#discussion_r2212373645
More information about the hotspot-dev
mailing list