JDK-8352649 : [17u] guarantee(is_result_safe || is_in_asgct()) failed inside AsyncGetCallTrace
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 17.0.14
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • OS: linux
  • CPU: generic
  • Submitted: 2025-03-23
  • Updated: 2025-03-24
Related Reports
Relates :  
Relates :  
Relates :  
Description
There are multiple bug reports against async-profiler and Datadog profiler referring to

guarantee(is_result_safe || is_in_asgct()) failed: unsafe access to zombie method

Examples:
https://github.com/async-profiler/async-profiler/issues/1168
https://github.com/DataDog/dd-trace-java/issues/7144

is_in_asgct() returns false despite AsyncGetCallTrace being clearly visible on the stack trace:

Current thread (0x00007ff7d4092870):  JavaThread "I/O dispatcher 103" [_thread_in_Java, id=560, stack(0x00007ff7a14d5000,0x00007ff7a15d6000)]

Stack: [0x00007ff7a14d5000,0x00007ff7a15d6000],  sp=0x00007ff7a15d3830,  free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x5a6c04]  CodeCache::find_blob(void*)+0xf4
V  [libjvm.so+0xe7928b]  JavaThread::pd_get_top_frame(frame*, void*, bool)+0x16b
V  [libjvm.so+0x6c8526]  AsyncGetCallTrace+0x176

The bug appeared as a result of two conflicting backports:
https://github.com/openjdk/jdk17u/commit/19639855311a and https://github.com/openjdk/jdk17u/commit/c2e274e8578427144294735dc06a2f92ffc7cbde

Now, JavaThread has two `_in_asgct` fields: one is declared in Thread class, and another in JavaThread class. AsyncGetCallTrace sets the former field while the above guarantee checks the latter field.
Comments
[jdk17u-fix-request] Approval Request from Andrei Pangin Fixes JVM crash during profiling. Low risk: straightforward removal of duplicate field in JavaThread class; affects only AsyncGetCallTrace execution path.
24-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk17u-dev/pull/3400 Date: 2025-03-23 22:39:10 +0000
23-03-2025