jstack launched with AOT cache created with -XX:+AOTClassLinking crashes with
Internal Error (/work/JavaSE/Hotspot/ws/git/leyden.483-candidate/open/src/hotspot/share/oops/instanceKlass.cpp:862), pid=23511, tid=23512
assert(is_loaded()) failed: must be loaded
#
JRE version: (24.0) (fastdebug build )
Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 24-internal-2024-10-11-0536092.katya..., mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
Problematic frame:
V [libjvm.so+0xe5f36f] InstanceKlass::link_class(JavaThread*)+0x5f
-------------- T H R E A D ---------------
Current thread (0x00007f902802e420): JavaThread "Unknown thread" [_thread_in_vm, id=23512, stack(0x00007f9031a1a000,0x00007f9031b1b000) (1028K)]
Stack: [0x00007f9031a1a000,0x00007f9031b1b000], sp=0x00007f9031b19300, free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xe5f36f] InstanceKlass::link_class(JavaThread*)+0x5f (instanceKlass.cpp:862)
V [libjvm.so+0xe60ffa] InstanceKlass::initialize_impl(JavaThread*)+0x4a (instanceKlass.cpp:1147)
V [libjvm.so+0xe61dfe] InstanceKlass::initialize(JavaThread*)+0x9e (instanceKlass.cpp:780)
V [libjvm.so+0xe972d7] InterpreterRuntime::_new(JavaThread*, ConstantPool*, int)+0x137 (interpreterRuntime.cpp:224)
j java.lang.String.<clinit>()V+11 java.base
v ~StubRoutines::call_stub 0x00007f9017c8cd01
V [libjvm.so+0xeaf82c] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x48c (javaCalls.cpp:421)
V [libjvm.so+0xe5b5c3] InstanceKlass::call_class_initializer(JavaThread*)+0x2a3 (instanceKlass.cpp:1676)
V [libjvm.so+0xe61785] InstanceKlass::initialize_impl(JavaThread*)+0x7d5 (instanceKlass.cpp:1279)
V [libjvm.so+0xe61dfe] InstanceKlass::initialize(JavaThread*)+0x9e (instanceKlass.cpp:780)
V [libjvm.so+0x182d0ce] initialize_class(Symbol*, JavaThread*)+0x6e (threads.cpp:124)
V [libjvm.so+0x182e9ad] Threads::initialize_java_lang_classes(JavaThread*, JavaThread*)+0x5d (threads.cpp:340)
V [libjvm.so+0x1832343] Threads::create_vm(JavaVMInitArgs*, bool*)+0x493 (threads.cpp:652)
V [libjvm.so+0xfcb0e4] JNI_CreateJavaVM+0x54 (jni.cpp:3594)
C [libjli.so+0x432f] JavaMain+0x8f (java.c:1490)
C [libjli.so+0x79b9] ThreadJavaMain+0x9 (java_md.c:633)
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j java.lang.String.<clinit>()V+11 java.base
v ~StubRoutines::call_stub 0x00007f9017c8cd01
To reproduce just do for example
> create AOT cache for jdk classes:
TESTED_JAVA/bin/java -XX:AOTMode=create -XX:AOTConfiguration=TESTED_JAVA/lib/classlist -XX:AOTCache=jdk.aot -XX:+AOTClassLinking
> run jstack with the above cache
TESTED_JAVA/bin/bin/jstack -J-XX:AOTCache=jdk.aot -l 12345
Internal Error (/work/JavaSE/Hotspot/ws/git/leyden.483-candidate/open/src/hotspot/share/oops/instanceKlass.cpp:862), pid=23511, tid=23512
assert(is_loaded()) failed: must be loaded
#
JRE version: (24.0) (fastdebug build )
Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 24-internal-2024-10-11-0536092.katya..., mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
Problematic frame:
V [libjvm.so+0xe5f36f] InstanceKlass::link_class(JavaThread*)+0x5f
-------------- T H R E A D ---------------
Current thread (0x00007f902802e420): JavaThread "Unknown thread" [_thread_in_vm, id=23512, stack(0x00007f9031a1a000,0x00007f9031b1b000) (1028K)]
Stack: [0x00007f9031a1a000,0x00007f9031b1b000], sp=0x00007f9031b19300, free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xe5f36f] InstanceKlass::link_class(JavaThread*)+0x5f (instanceKlass.cpp:862)
V [libjvm.so+0xe60ffa] InstanceKlass::initialize_impl(JavaThread*)+0x4a (instanceKlass.cpp:1147)
V [libjvm.so+0xe61dfe] InstanceKlass::initialize(JavaThread*)+0x9e (instanceKlass.cpp:780)
V [libjvm.so+0xe972d7] InterpreterRuntime::_new(JavaThread*, ConstantPool*, int)+0x137 (interpreterRuntime.cpp:224)
j java.lang.String.<clinit>()V+11 java.base
v ~StubRoutines::call_stub 0x00007f9017c8cd01
V [libjvm.so+0xeaf82c] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x48c (javaCalls.cpp:421)
V [libjvm.so+0xe5b5c3] InstanceKlass::call_class_initializer(JavaThread*)+0x2a3 (instanceKlass.cpp:1676)
V [libjvm.so+0xe61785] InstanceKlass::initialize_impl(JavaThread*)+0x7d5 (instanceKlass.cpp:1279)
V [libjvm.so+0xe61dfe] InstanceKlass::initialize(JavaThread*)+0x9e (instanceKlass.cpp:780)
V [libjvm.so+0x182d0ce] initialize_class(Symbol*, JavaThread*)+0x6e (threads.cpp:124)
V [libjvm.so+0x182e9ad] Threads::initialize_java_lang_classes(JavaThread*, JavaThread*)+0x5d (threads.cpp:340)
V [libjvm.so+0x1832343] Threads::create_vm(JavaVMInitArgs*, bool*)+0x493 (threads.cpp:652)
V [libjvm.so+0xfcb0e4] JNI_CreateJavaVM+0x54 (jni.cpp:3594)
C [libjli.so+0x432f] JavaMain+0x8f (java.c:1490)
C [libjli.so+0x79b9] ThreadJavaMain+0x9 (java_md.c:633)
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j java.lang.String.<clinit>()V+11 java.base
v ~StubRoutines::call_stub 0x00007f9017c8cd01
To reproduce just do for example
> create AOT cache for jdk classes:
TESTED_JAVA/bin/java -XX:AOTMode=create -XX:AOTConfiguration=TESTED_JAVA/lib/classlist -XX:AOTCache=jdk.aot -XX:+AOTClassLinking
> run jstack with the above cache
TESTED_JAVA/bin/bin/jstack -J-XX:AOTCache=jdk.aot -l 12345