Creation of AOT cache file could crash with
# Internal Error (workspace/open/src/hotspot/share/cds/aotClassLocation.cpp:920), pid=29025, tid=29026
# assert(len > remove_prefix_len) failed: sanity
#
# JRE version: (25.0+21) (fastdebug build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-ea+21-LTS-2530, interpreted mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x65f789] AOTClassLocationConfig::substitute(char const*, unsigned long, char const*, unsigned long)+0x129
Current thread (0x00007ff49002e3b0): JavaThread "Unknown thread" [_thread_in_vm, id=29026, stack(0x00007ff498940000,0x00007ff498a41000) (1028K)]
Stack: [0x00007ff498940000,0x00007ff498a41000], sp=0x00007ff498a3d2e0, free space=1012k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x65f789] AOTClassLocationConfig::substitute(char const*, unsigned long, char const*, unsigned long)+0x129 (aotClassLocation.cpp:920)
V [libjvm.so+0x65fdab] AOTClassLocationConfig::print_dumptime_classpath(LogStream&, int, int, bool, unsigned long, char const*, unsigned long) const+0x60b
V [libjvm.so+0x66142d] AOTClassLocationConfig::check_classpaths(bool, bool, int, int, ClassLocationStream&, bool, char const*, unsigned long) const+0x27d
V [libjvm.so+0x663e2f] AOTClassLocationConfig::validate(bool, bool*) const+0xb2f
V [libjvm.so+0xd4b80d] FileMapInfo::validate_class_location()+0x4d
V [libjvm.so+0x1611423] MetaspaceShared::map_archive(FileMapInfo*, char*, ReservedSpace)+0xc3
V [libjvm.so+0x1613b6f] MetaspaceShared::map_archives(FileMapInfo*, FileMapInfo*, bool)+0x1ef
V [libjvm.so+0x16142d2] MetaspaceShared::initialize_runtime_shared_and_meta_spaces()+0xc2
V [libjvm.so+0x1608a7d] Metaspace::global_initialize()+0x45d
V [libjvm.so+0x1aee294] universe_init()+0x144
V [libjvm.so+0xfc2d9c] init_globals()+0x4c
V [libjvm.so+0x1abb15e] Threads::create_vm(JavaVMInitArgs*, bool*)+0x34e
V [libjvm.so+0x1176174] JNI_CreateJavaVM+0x54
C [libjli.so+0x3dff] JavaMain+0x8f
C [libjli.so+0x8019] ThreadJavaMain+0x9
Registers:
RAX=0x00007ff498a5d000, RBX=0x0000000000000000, RCX=0x00007ff49771f141, RDX=0x00007ff49779d9b8
RSP=0x00007ff498a3d2e0, RBP=0x00007ff498a3d320, RSI=0x0000000000000398, RDI=0x00007ff49779d878
R8 =0x0000000000000000, R9 =0x0000000000000000, R10=0x000055bc5987fc70, R11=0x00007ff498617490
R12=0x0000000000000000, R13=0x0000000800bc0ab8, R14=0x00007ff49771f462, R15=0x0000000000000000
RIP=0x00007ff496080789, EFLAGS=0x0000000000010246, CSGSFS=0x002b000000000033, ERR=0x0000000000000006
TRAPNO=0x000000000000000e
XMM[0]=0x0000000000000000 0x0000000000000000
XMM[1]=0x0000000000000000 0x0000000000000000
XMM[2]=0x0000000000000000 0x0000000000000000
XMM[3]=0x0000000000000000 0x0000000000000000
XMM[4]=0xffffffffffffff00 0xffffffffffffffff
XMM[5]=0x0000000000000000 0x0000000000000000
XMM[6]=0x0000000000000000 0x0000000000000000
XMM[7]=0x0000000000000000 0x0000000000000000
XMM[8]=0x6e657372616f6320 0x38207374656b6375
XMM[9]=0x0000000000000000 0x0000000000000000
XMM[10]=0x0000000000000000 0x0020000000000000
XMM[11]=0x0000000000000000 0x3fe62c42eef98d4d
XMM[12]=0x0000000000000000 0x3c85380000000000
XMM[13]=0x0000000000000000 0x3f30008005559800
XMM[14]=0x0000000000000000 0x3fe62e42fefa3800
XMM[15]=0xcafebabecafebabe 0xcafebabecafebabe
MXCSR=0x00001fa2
in case -classpath specified during AOT config creation looks like ":file.jar" and then classpath is missed during AOT cache creation.
See attached HelloCrash.sh for more details.
The issue is seen in latest jdk25b21.
# Internal Error (workspace/open/src/hotspot/share/cds/aotClassLocation.cpp:920), pid=29025, tid=29026
# assert(len > remove_prefix_len) failed: sanity
#
# JRE version: (25.0+21) (fastdebug build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-ea+21-LTS-2530, interpreted mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x65f789] AOTClassLocationConfig::substitute(char const*, unsigned long, char const*, unsigned long)+0x129
Current thread (0x00007ff49002e3b0): JavaThread "Unknown thread" [_thread_in_vm, id=29026, stack(0x00007ff498940000,0x00007ff498a41000) (1028K)]
Stack: [0x00007ff498940000,0x00007ff498a41000], sp=0x00007ff498a3d2e0, free space=1012k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x65f789] AOTClassLocationConfig::substitute(char const*, unsigned long, char const*, unsigned long)+0x129 (aotClassLocation.cpp:920)
V [libjvm.so+0x65fdab] AOTClassLocationConfig::print_dumptime_classpath(LogStream&, int, int, bool, unsigned long, char const*, unsigned long) const+0x60b
V [libjvm.so+0x66142d] AOTClassLocationConfig::check_classpaths(bool, bool, int, int, ClassLocationStream&, bool, char const*, unsigned long) const+0x27d
V [libjvm.so+0x663e2f] AOTClassLocationConfig::validate(bool, bool*) const+0xb2f
V [libjvm.so+0xd4b80d] FileMapInfo::validate_class_location()+0x4d
V [libjvm.so+0x1611423] MetaspaceShared::map_archive(FileMapInfo*, char*, ReservedSpace)+0xc3
V [libjvm.so+0x1613b6f] MetaspaceShared::map_archives(FileMapInfo*, FileMapInfo*, bool)+0x1ef
V [libjvm.so+0x16142d2] MetaspaceShared::initialize_runtime_shared_and_meta_spaces()+0xc2
V [libjvm.so+0x1608a7d] Metaspace::global_initialize()+0x45d
V [libjvm.so+0x1aee294] universe_init()+0x144
V [libjvm.so+0xfc2d9c] init_globals()+0x4c
V [libjvm.so+0x1abb15e] Threads::create_vm(JavaVMInitArgs*, bool*)+0x34e
V [libjvm.so+0x1176174] JNI_CreateJavaVM+0x54
C [libjli.so+0x3dff] JavaMain+0x8f
C [libjli.so+0x8019] ThreadJavaMain+0x9
Registers:
RAX=0x00007ff498a5d000, RBX=0x0000000000000000, RCX=0x00007ff49771f141, RDX=0x00007ff49779d9b8
RSP=0x00007ff498a3d2e0, RBP=0x00007ff498a3d320, RSI=0x0000000000000398, RDI=0x00007ff49779d878
R8 =0x0000000000000000, R9 =0x0000000000000000, R10=0x000055bc5987fc70, R11=0x00007ff498617490
R12=0x0000000000000000, R13=0x0000000800bc0ab8, R14=0x00007ff49771f462, R15=0x0000000000000000
RIP=0x00007ff496080789, EFLAGS=0x0000000000010246, CSGSFS=0x002b000000000033, ERR=0x0000000000000006
TRAPNO=0x000000000000000e
XMM[0]=0x0000000000000000 0x0000000000000000
XMM[1]=0x0000000000000000 0x0000000000000000
XMM[2]=0x0000000000000000 0x0000000000000000
XMM[3]=0x0000000000000000 0x0000000000000000
XMM[4]=0xffffffffffffff00 0xffffffffffffffff
XMM[5]=0x0000000000000000 0x0000000000000000
XMM[6]=0x0000000000000000 0x0000000000000000
XMM[7]=0x0000000000000000 0x0000000000000000
XMM[8]=0x6e657372616f6320 0x38207374656b6375
XMM[9]=0x0000000000000000 0x0000000000000000
XMM[10]=0x0000000000000000 0x0020000000000000
XMM[11]=0x0000000000000000 0x3fe62c42eef98d4d
XMM[12]=0x0000000000000000 0x3c85380000000000
XMM[13]=0x0000000000000000 0x3f30008005559800
XMM[14]=0x0000000000000000 0x3fe62e42fefa3800
XMM[15]=0xcafebabecafebabe 0xcafebabecafebabe
MXCSR=0x00001fa2
in case -classpath specified during AOT config creation looks like ":file.jar" and then classpath is missed during AOT cache creation.
See attached HelloCrash.sh for more details.
The issue is seen in latest jdk25b21.