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

-Xshare:dump with default classlist fails on static JDK

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • hotspot
    • None

      -Xshare:dump with default classlist fails on static JDK:

      $ bin/java -Xshare:dump
      Error occurred during initialization of VM
      Loading classlist /<snip>/build/linux-x86_64-server-slowdebug/images/lib/classlist failed: No such file or directory

      Many CDS jtreg tests do -Xshare:dump using the default classlist and fail on static JDK. I noticed the failures recently when testing on mainline. The hermetic Java prototype works on top of other changes which masks the issue, hence leyden/hermetic-java-runtime has not been fixed for this specific issue.

      MetaspaceShared::get_default_classlist resolves the default classlist path using os::jvm_path returned path. On regular JDK, os::jvm_path gives the path to libjvm. MetaspaceShared::get_default_classlist removes the last two directory components (e.g. '<variant>/libjvm.so') from the path, then adds 'lib/classlist' to the path. There is also some subtle handling of adding '/lib' component optionally.

      On static JDK, os::jvm_path returns the path to the 'bin/java' launcher executable. Due to the directory structure difference, the assumption is MetaspaceShared::get_default_classlist is no longer true, hence resolves incorrect path.

      I think Arguments::get_java_home should be used when resolving the default classlist path. It avoids complications of walking up the directory from libjvm and subtle handling for '/lib' dir.

            jiangli Jiangli Zhou
            jiangli Jiangli Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: