RFR: 8364314: java_lang_Thread::get_thread_status fails assert(base != nullptr) failed: Invalid base [v2]

Patricio Chilano Mateo pchilanomate at openjdk.org
Thu Jul 31 00:18:54 UTC 2025


On Wed, 30 Jul 2025 17:29:42 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

> In src/hotspot/share/prims/whitebox.cpp, we have three functions:
> 
> * WB_HandshakeReadMonitors
> * WB_HandshakeWalkStack
> * WB_AsyncHandshakeWalkStack
> 
> that call `tlh.cv_internal_thread_to_JavaThread` and each of them does a handshake operation with the 'target' thread. If the `target` is a virtual thread, then we'll do the handshake with the carrier thread and not with the virtual thread. None of these functions in whitebox.cpp use a JvmtiVTMSTransitionDisabler to prevent the virtual thread from being unmounted from the carrier thread. I could be missing it, but I don't see a way that the virtual thread info that _should be_ mounted on the carrier thread is being passed to the handshake code. So what does the handshake code do when it gets down into the guts and the carrier thread no longer has a virtual thread mounted on it or if a different virtual thread is mounted on it?
> 
> I'm not sure who to ping for answering this query.
>
Currently these are only used in tests with platform threads. If we would pass a virtual thread as argument, then in those cases you mentioned we would read/print the state of some other thread in the handshake closure, but there shouldn’t be a crash.

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

PR Comment: https://git.openjdk.org/jdk/pull/26544#issuecomment-3138198215


More information about the hotspot-runtime-dev mailing list