JDK-8353298 : [leyden] AOT cache creation crashes with "assert(is_instance_klass()) failed: sanity"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: repo-leyden
  • Priority: P3
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2025-03-31
  • Updated: 2025-04-01
Description
Running several JCK tests in aot mode crashes during AOT cache creation with following assertion:

# Internal Error (/home/katya/work/JavaSE/Hotspot/ws/git/leyden.premain/open/src/hotspot/share/oops/klass.cpp:833), pid=4727, tid=4740
#  assert(is_instance_klass()) failed: sanity
#
# JRE version: Java(TM) SE Runtime Environment (25.0) (fastdebug build 25-internal-LTS-2025-03-31-1644162.katya...)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-internal-LTS-2025-03-31-1644162.katya..., mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x13af610]  Klass::remove_java_mirror()+0x3f0

Current thread (0x00007f99c4678b90):  VMThread "VM Thread"          [id=4740, stack(0x00007f99c9170000,0x00007f99c9270000) (1024K)]

Stack: [0x00007f99c9170000,0x00007f99c9270000],  sp=0x00007f99c926e540,  free space=1017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x13af610]  Klass::remove_java_mirror()+0x3f0  (klass.cpp:833)
V  [libjvm.so+0x686f05]  ArrayKlass::remove_java_mirror()+0x15  (arrayKlass.cpp:227)
V  [libjvm.so+0x64db90]  ArchiveBuilder::make_klasses_shareable()+0x240  (archiveBuilder.cpp:830)
V  [libjvm.so+0x15b93d9]  VM_PopulateDumpSharedSpace::doit()+0x419  (metaspaceShared.cpp:691)
V  [libjvm.so+0x1b4c79f]  VM_Operation::evaluate()+0x18f  (vmOperations.cpp:74)
V  [libjvm.so+0x1b6e308]  VMThread::evaluate_operation(VM_Operation*)+0x168  (vmThread.cpp:285)
V  [libjvm.so+0x1b6f223]  VMThread::inner_execute(VM_Operation*)+0x423  (vmThread.cpp:429)
V  [libjvm.so+0x1b6f3c4]  VMThread::loop()+0x84  (vmThread.cpp:495)
V  [libjvm.so+0x1b6f5ec]  VMThread::run()+0x1ac  (vmThread.cpp:179)
V  [libjvm.so+0x1a51f16]  Thread::call_run()+0xb6  (thread.cpp:242)
V  [libjvm.so+0x16daf70]  thread_native_entry(Thread*)+0x290  (os_linux.cpp:877)

Comments
The tests crashed on linux-aarch64-debug in mach5 but I can easy reproduce it on my local linux-x64 machine.
31-03-2025