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

David Holmes dholmes at openjdk.org
Fri Jul 4 01:49:38 UTC 2025


On Thu, 3 Jul 2025 20:03:06 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

>> The fix updates `java_lang_Thread::async_get_stack_trace()` (used by `java.lang.Thread.getStackTrace()` to get stack trace for platform and mounted virtual threads) to correctly use `ThreadListHandle` for thread protection.
>> 
>> Testing: tier1..5
>
> Alex Menkov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update javaClasses.cpp

Generally looks good. A couple of minor nits/queries.

Thanks

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`?

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?

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

PR Review: https://git.openjdk.org/jdk/pull/26119#pullrequestreview-2985170142
PR Review Comment: https://git.openjdk.org/jdk/pull/26119#discussion_r2184115254
PR Review Comment: https://git.openjdk.org/jdk/pull/26119#discussion_r2184116032


More information about the hotspot-dev mailing list