RFR: 8361103: java_lang_Thread::async_get_stack_trace does not properly protect JavaThread [v2]

Alex Menkov amenkov at openjdk.org
Mon Jul 7 19:40:39 UTC 2025


On Fri, 4 Jul 2025 01:42:27 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update javaClasses.cpp
>
> src/hotspot/share/classfile/javaClasses.cpp line 1896:
> 
>> 1894:       return nullptr;
>> 1895:     }
>> 1896:     java_thread = java_lang_Thread::thread(carrier_thread);
> 
> Won't `java_thread` already have been set correctly by `cv_internal_thread_to_JavaThread`?

No. This is for virtual thread. We need to get JavaThread from the carrier

> src/hotspot/share/classfile/javaClasses.cpp line 1899:
> 
>> 1897:   }
>> 1898:   if (java_thread == nullptr) {
>> 1899:     // terminated platform thread or unmounted virtual thread
> 
> Wasn't the unmounted virtual thread case already handled by the return at line 1894?

Yes, right.
Removed the comment

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26119#discussion_r2190882884
PR Review Comment: https://git.openjdk.org/jdk/pull/26119#discussion_r2190883998


More information about the hotspot-dev mailing list