RFR: 8332259: JvmtiTrace::safe_get_thread_name fails if current thread is in native state [v2]

Leonid Mesnik lmesnik at openjdk.org
Fri May 17 02:08:34 UTC 2024


> 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - copyrights updated.
 - Merge branch 'master' of https://github.com/openjdk/jdk into 8332259
 - include updated.
 - 8332259

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19275/files
  - new: https://git.openjdk.org/jdk/pull/19275/files/a2b1942b..c534c91b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19275&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19275&range=00-01

  Stats: 30226 lines in 654 files changed: 18294 ins; 7842 del; 4090 mod
  Patch: https://git.openjdk.org/jdk/pull/19275.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19275/head:pull/19275

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


More information about the serviceability-dev mailing list