RFR: 8361103: java_lang_Thread::async_get_stack_trace does not properly protect JavaThread [v4]
David Holmes
dholmes at openjdk.org
Mon Jul 21 04:30:42 UTC 2025
On Mon, 21 Jul 2025 04:27:29 GMT, David Holmes <dholmes at openjdk.org> wrote:
>>> @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.
>>
>> Yes, we have this issue for `HotsotDiagnosticMXBean.dumpThreads` as Alan has pointed out. We are aware about it and will evaluate a couple of fixing approaches.
>
>> Thread::getStackTrace handles this with a SUSPEND bit and loop.
>
> Okay so that loop keeps retrying any time we get a null stacktrace from the VM, and unless we are extremely unlucky it should only take a couple of attempts to get an actual stack.
>
> So that just leaves the issue of the carrier thread terminating, which is what this current fix was trying to address. So we need to ensure the carrier is protected by the TLH, which is what my other fix will address.
BTW we need some comments making it clear that all null returns are handled via a retry at the higher level Java code.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26119#discussion_r2218160074
More information about the hotspot-dev
mailing list