On Tue, 28 May 2024 22:29:28 GMT, Leonid Mesnik <lmes...@openjdk.org> wrote:
>> The JvmtiTrace::safe_get_thread_name sometimes crashes when called while >> current thread is in native thread state. >> >> It happens when thread_name is set for tracing from jvmti functions. >> See: >> https://github.com/openjdk/jdk/blob/master/src/hotspot/share/prims/jvmtiEnter.xsl#L649 >> >> >> The setup is called and the thread name is used in tracing before the thread >> transition. There is no good location where this method could be called from >> vm thread_state only. Some functions like raw monitor enter/exit never >> transition in vm state. So sometimes it is needed to call this function from >> native thread state. >> >> The change should affect JVMTI trace mode only (-XX:TraceJVMTI). >> >> Verified by running jvmti/jdi/jdb tests with tracing enabled. > > Leonid Mesnik has updated the pull request incrementally with two additional > commits since the last revision: > > - fixed space. > - The result is updated. This looks good, Posted one nit though. src/hotspot/share/prims/jvmtiTrace.cpp line 284: > 282: JavaThreadState current_state = > JavaThread::cast(Thread::current())->thread_state(); > 283: if (current_state == _thread_in_native || current_state == > _thread_blocked) { > 284: return "not readable"; Nit: I'd suggest to make it more detailed, something like like this: "<non-readable thread name>" or "<NON-READABLE-THREAD-NAME>" ------------- Marked as reviewed by sspitsyn (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19275#pullrequestreview-2084079674 PR Review Comment: https://git.openjdk.org/jdk/pull/19275#discussion_r1618051643