RFR: 8361103: java_lang_Thread::async_get_stack_trace does not properly protect JavaThread [v6]
Alan Bateman
alanb at openjdk.org
Tue Aug 5 06:32:07 UTC 2025
On Tue, 5 Aug 2025 05:39:03 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
>>
>> fix broken build
>
> src/hotspot/share/classfile/javaClasses.cpp line 1941:
>
>> 1939: bool carrier = false;
>> 1940: if (java_lang_VirtualThread::is_instance(_java_thread())) {
>> 1941: // if (thread->vthread() != _java_thread()) // We might be inside a System.executeOnCarrierThread
>
> Need to check with @AlanBateman whether this check is also needed (he does both in his draft PR).
ThreadSnapshotFactory::get_thread_snapshot needs to fail (and the caller retry) if called while the target virtual thread is in transition. This is because it captures the thread state in addition to the stack trace, and several other properties. So this is why (in the draft changes) it checks that thread identity is set and that the continuation is mounted.
java_lang_Thread::async_get_stack_trace just needs to walk the continuation stack so checking that the continuation is mounted should be enough here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26119#discussion_r2253284124
More information about the hotspot-dev
mailing list