JDK-8303746 : AsyncGetCallTrace fails on Mac M1 on safepoint during instrumenting agent
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: arm
  • Submitted: 2023-03-07
  • Updated: 2023-07-17
  • Resolved: 2023-07-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Relates :  
Description
ASGCT causes a SIGBUS error while being called in a native method in an instrumentation agent (via https://github.com/parttimenerd/trace_validation ).

The GST stack trace at this occasion is:
```
Frame 0: Native frameLme/bechberger/trace/NativeChecker;.checkTrace()V
Frame 1: Java frame   Ljavassist/ClassPool;.get0(Ljava/lang/String;Z)Ljavassist/CtClass;: 0
Frame 2: Java frame   Ljavassist/ClassPool;.get0(Ljava/lang/String;Z)Ljavassist/CtClass;: 113
Frame 3: Java frame   Ljavassist/ClassPool;.get(Ljava/lang/String;)Ljavassist/CtClass;: 24
Frame 4: Java frame   Ljavassist/bytecode/stackmap/TypeData$TypeVar;.fixTypes2(Ljava/util/List;Ljava/util/Set;Ljavassist/ClassPool;)Ljava/lang/String;: 79
Frame 5: Java frame   Ljavassist/bytecode/stackmap/TypeData$TypeVar;.fixTypes(Ljava/util/List;Ljavassist/ClassPool;)V: 240
Frame 6: Java frame   Ljavassist/bytecode/stackmap/TypeData$TypeVar;.dfs(Ljava/util/List;ILjavassist/ClassPool;)I: 225
Frame 7: Java frame   Ljavassist/bytecode/stackmap/MapMaker;.fixTypes([B[Ljavassist/bytecode/stackmap/TypedBlock;)V: 115
Frame 8: Java frame   Ljavassist/bytecode/stackmap/MapMaker;.make([Ljavassist/bytecode/stackmap/TypedBlock;[B)V: 17
Frame 9: Java frame   Ljavassist/bytecode/stackmap/MapMaker;.make(Ljavassist/ClassPool;Ljavassist/bytecode/MethodInfo;)Ljavassist/bytecode/StackMapTable;: 50
Frame 10: Java frame   Ljavassist/bytecode/MethodInfo;.rebuildStackMap(Ljavassist/ClassPool;)V: 11
Frame 11: Java frame   Ljavassist/bytecode/MethodInfo;.rebuildStackMapIf6(Ljavassist/ClassPool;Ljavassist/bytecode/ClassFile;)V: 11
Frame 12: Java frame   Ljavassist/CtBehavior;.insertBefore(Ljava/lang/String;Z)V: 200
Frame 13: Java frame   Ljavassist/CtBehavior;.insertBefore(Ljava/lang/String;)V: 3
Frame 14: Java frame   Lme/bechberger/trace/ClassTransformer;.transform(Ljava/lang/String;Ljavassist/CtMethod;)V: 50
Frame 15: Java frame   Lme/bechberger/trace/ClassTransformer;.transform(Ljava/lang/String;Ljavassist/CtClass;)V: 40
Frame 16: Java frame   Lme/bechberger/trace/ClassTransformer;.transform(Ljava/lang/Module;Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Class;Ljava/security/ProtectionDomain;[B)[B: 98
Frame 17: Java frame   Lsun/instrument/TransformerManager;.transform(Ljava/lang/Module;Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Class;Ljava/security/ProtectionDomain;[B)[B: 52
Frame 18: Java frame   Lsun/instrument/InstrumentationImpl;.transform(Ljava/lang/Module;Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/lang/Class;Ljava/security/ProtectionDomain;[BZ)[B: 69
```

The error is:

```
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGBUS (0xa) at pc=0x0000000105b94318, pid=99072, tid=5379
#
# JRE version: OpenJDK Runtime Environment (21.0) (build 21-internal-adhoc.i560383.jdk)
# Java VM: OpenJDK 64-Bit Server VM (21-internal-adhoc.i560383.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# V  [libjvm.dylib+0x810318]  PcDescContainer::find_pc_desc_internal(unsigned char*, bool, PcDescSearch const&)+0x1cc
...
V  [libjvm.dylib+0x810318]  PcDescContainer::find_pc_desc_internal(unsigned char*, bool, PcDescSearch const&)+0x1cc
V  [libjvm.dylib+0x4e4b4c]  vframeStreamCommon::fill_from_frame()+0xd4
V  [libjvm.dylib+0x3aec28]  vframeStreamForte::forte_next()+0xa8
V  [libjvm.dylib+0x3af5e0]  forte_fill_call_trace_given_top(JavaThread*, ASGCT_CallTrace*, int, frame)+0x664
V  [libjvm.dylib+0x3aef30]  AsyncGetCallTrace+0x238
C  [libjnilibrary919094732584229861.dylib+0x6ae8]  Java_me_bechberger_trace_NativeChecker_checkTrace+0x164
J 1671  me.bechberger.trace.NativeChecker.checkTrace()V (0 bytes) @ 0x0000000112a726e0 [0x0000000112a72640+0x00000000000000a0]
C  0x000000070ecd6590
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 1671  me.bechberger.trace.NativeChecker.checkTrace()V (0 bytes) @ 0x0000000112a726e0 [0x0000000112a72640+0x00000000000000a0]
J 1805 c1 javassist.ClassPool.get0(Ljava/lang/String;Z)Ljavassist/CtClass; (140 bytes) @ 0x000000010b2b463c [0x000000010b2b4540+0x00000000000000fc]
J 1805 c1 javassist.ClassPool.get0(Ljava/lang/String;Z)Ljavassist/CtClass; (140 bytes) @ 0x000000010b2b47b0 [0x000000010b2b4540+0x0000000000000270]
j  javassist.ClassPool.get(Ljava/lang/String;)Ljavassist/CtClass;+24
```

This is only reproducible on Mac M1 and not on Linux.

Comments
Johannes, can we close this as duplicate of JDK-8304725?
17-07-2023

Yes.
17-07-2023

ILW: MMH= P3
07-03-2023