Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8343416

CDS dump fails when unregistered class can also be loaded from system modules

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 24
    • 24
    • hotspot
    • b24

      This problem happens in JDK mainline as well. The classlist specifies an "unregistered" class (intended for custom class loaders) from a JAR file. However, a class of the same name also exists in $JAVA_HOME/lib/modules

      ============= minimal reproducer ===========
      $ cat << END > test.classlist
      java/nio/file/spi/FileSystemProvider id: 1000
      jdk/internal/jrtfs/JrtFileSystemProvider id: 1001 super:1000 source: $JAVA_HOME/lib/jrt-fs.jar
      END

      $ $JAVA_HOME/bin/java -Xshare:dump -XX:SharedClassListFile=test.classlist -XX:SharedArchiveFile=test.jsa

      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/jdk3/yax/open/src/hotspot/share/cds/classListParser.cpp:526), pid=936497, tid=936498
      # assert(k->is_shared_unregistered_class()) failed: must be



      ============= original report ===========

      AOT cache creation could crash with

      # Internal Error (/home/katya/work/JavaSE/Hotspot/ws/git/leyden.483-candidate.pit/open/src/hotspot/share/cds/classListParser.cpp:526), pid=6948, tid=6950
      # assert(k->is_shared_unregistered_class()) failed: must be
      #
      # JRE version: Java(TM) SE Runtime Environment (24.0) (fastdebug build 24-internal-2024-10-31-1705164.katya...)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 24-internal-2024-10-31-1705164.katya..., interpreted mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x9acaa3] ClassListParser::load_class_from_source(Symbol*, JavaThread*)+0x273

      --------------- T H R E A D ---------------

      Current thread (0x00007f7a1002e5b0): JavaThread "main" [_thread_in_vm, id=6950, stack(0x00007f7a19cf7000,0x00007f7a19df8000) (1028K)]

      Stack: [0x00007f7a19cf7000,0x00007f7a19df8000], sp=0x00007f7a19df3200, free space=1008k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x9acaa3] ClassListParser::load_class_from_source(Symbol*, JavaThread*)+0x273 (classListParser.cpp:526)
      V [libjvm.so+0x9acf70] ClassListParser::load_current_class(Symbol*, JavaThread*)+0x30 (classListParser.cpp:703)
      V [libjvm.so+0x9adae2] ClassListParser::parse_class_name_and_attributes(JavaThread*) [clone .part.0]+0x62 (classListParser.cpp:145)
      V [libjvm.so+0x9b3c97] ClassListParser::parse(JavaThread*)+0x127 (classListParser.cpp:139)
      V [libjvm.so+0x1416e44] MetaspaceShared::preload_classes(JavaThread*)+0x84 (classListParser.hpp:144)
      V [libjvm.so+0x141bdb2] MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder&, JavaThread*)+0x22 (metaspaceShared.cpp:846)
      V [libjvm.so+0x141c387] MetaspaceShared::preload_and_dump(JavaThread*)+0x67 (metaspaceShared.cpp:727)
      V [libjvm.so+0x18557f6] Threads::create_vm(JavaVMInitArgs*, bool*)+0xed6 (threads.cpp:851)
      V [libjvm.so+0xff3974] JNI_CreateJavaVM+0x54 (jni.cpp:3596)
      C [libjli.so+0x432f] JavaMain+0x8f (java.c:1490)
      C [libjli.so+0x79c9] ThreadJavaMain+0x9 (java_md.c:633)
      Registers:
      RAX=0x00007f7a19e14000, RBX=0x00007f7a19df34e0, RCX=0x00007f7a18b2ee82, RDX=0x00007f7a18be9938
      RSP=0x00007f7a19df3200, RBP=0x00007f7a19df3270, RSI=0x000000000000020e, RDI=0x00007f7a18be95b0
      R8 =0x0000000057041710, R9 =0x0000000000000001, R10=0x00007f7a19df3020, R11=0x001fb1b1164195f9
      R12=0x00007f7a1002e5b0, R13=0x00000000572c27f0, R14=0x00007f7a19df3200, R15=0x00007f7a1918bd64
      RIP=0x00007f7a179e5aa3, EFLAGS=0x0000000000010202, CSGSFS=0x002b000000000033, ERR=0x0000000000000006
        TRAPNO=0x000000000000000e


            ccheung Calvin Cheung
            epavlova Ekaterina Pavlova
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: