Integrated: 8332259: JvmtiTrace::safe_get_thread_name fails if current thread is in native state

Leonid Mesnik lmesnik at openjdk.org
Wed May 29 15:02:14 UTC 2024


On Fri, 17 May 2024 01:48:30 GMT, Leonid Mesnik <lmesnik at 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.

This pull request has now been integrated.

Changeset: 03b7a858
Author:    Leonid Mesnik <lmesnik at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/03b7a8586a77983b1851ddd3f4555fe2fca57919
Stats:     17 lines in 2 files changed: 16 ins; 0 del; 1 mod

8332259: JvmtiTrace::safe_get_thread_name fails if current thread is in native state

Reviewed-by: dholmes, sspitsyn

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

PR: https://git.openjdk.org/jdk/pull/19275


More information about the serviceability-dev mailing list