JDK-8352775 : java -XX:AOTMode=create -XX:+UseZGC crashes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 25
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-03-25
  • Updated: 2025-03-25
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.
JDK 25
25Unresolved
Related Reports
Causes :  
Description
Originally reported at https://mail.openjdk.org/pipermail/leyden-dev/2025-March/001778.html

----- simplified reproducer -----

$ java -XX:-UseCompressedOops -XX:+UseZGC \
   -cp HelloWorld.jar \
   -XX:AOTMode=record \
   -XX:AOTConfiguration=hw.aotconfig \
   HelloWorld
Hello World
AOTConfiguration recorded: hw.aotconfig

$ java -XX:-UseCompressedOops -XX:+UseZGC \
   -cp HelloWorld.jar \
   -XX:AOTMode=create \
   -XX:AOTConfiguration=hw.aotconfig \
   -XX:AOTCache=hw.aot

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f8c45695fb1, pid=992401, tid=992402

V  [libjvm.so+0xe9383c]  MetaspaceObjToOopHandleTable::set_oop(MetaspaceObj*, oopDesc*)+0x64  (heapShared.cpp:382)
V  [libjvm.so+0xe8c064]  HeapShared::add_scratch_resolved_references(ConstantPool*, objArrayOopDesc*)+0x4a  (heapShared.cpp:397)
V  [libjvm.so+0xab7896]  ConstantPool::restore_unshareable_info(JavaThread*)+0x4e2  (constantPool.cpp:460)
V  [libjvm.so+0x175acc9]  vmClasses::resolve_all(JavaThread*)+0x13d  (vmClasses.cpp:142)
V  [libjvm.so+0x167625c]  SystemDictionary::initialize(JavaThread*)+0x8e  (systemDictionary.cpp:1600)
V  [libjvm.so+0x16f1778]  Universe::genesis(JavaThread*)+0x3f6  (universe.cpp:439)
V  [libjvm.so+0x16f3ebb]  universe2_init()+0x30  (universe.cpp:1077)
V  [libjvm.so+0xeb71b2]  init_globals2()+0x9  (init.cpp:161)
V  [libjvm.so+0x16cc2c2]  Threads::create_vm(JavaVMInitArgs*, bool*)+0x468  (threads.cpp:595)
V  [libjvm.so+0xffeed4]  JNI_CreateJavaVM_inner(JavaVM_**, void**, void*)+0x93  (jni.cpp:3587)
V  [libjvm.so+0xfff30a]  JNI_CreateJavaVM+0x32  (jni.cpp:3678)
C  [libjli.so+0x3c7f]  JavaMain+0x8f
C  [libjli.so+0x7ca9]  ThreadJavaMain+0x9
C  [libc.so.6+0x9caa4]

Comments
This bug is introduced in JDK 25 (JDK-8348426). It does not affect JDK 24. In JDK 24, when "-XX:AOTMode=create -XX:+UseZGC" is specified, -XX:+AOTClassLinking is automatically disabled. JDK 25 should do the same.
25-03-2025