JDK-8276769 : -Xshare:auto should tolerate problems in the CDS archive
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-11-05
  • Updated: 2021-12-16
  • Resolved: 2021-12-08
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 18 JDK 19
18 b28Fixed 19Fixed
Related Reports
Relates :  
Relates :  
Description
-Xshare:auto, which is the default, is supposed to use the specified archive if possible, but otherwise the VM should continue normal execution and ignore the specified archive(s).

However, in some cases, a bad archive would cause the VM to fail during start-up:

See attachments for bug.sh and log.txt

$ bash bug.sh $JAVA 2>&1 | cat > log.txt
$ cat log.txt
[....]
----------------------------------------------------------------------
Test case 2A: bad dynamic archive header, two archives
----------------------------------------------------------------------
+ /home/iklam/jdk/bld/nep/images/jdk/bin/java -Xshare:auto -Xlog:cds -cp HelloWorld.jar -XX:SharedArchiveFile=base.jsa:yyy.jsa HelloWorld
Error occurred during initialization of VM
Not a top shared archive: yyy.jsa

=====================================
Proposed new behavior:

-XX:SharedArchiveFile=foo.jsa
     -> if foo.jsa cannot be loaded, continue execution with CDS disabled

-XX:SharedArchiveFile=base.jsa:top.jsa
    -> if top.jsa cannot be loaded, or does not match base.jsa
         -> if base.jsa cannot be loaded, continue execution with CDS disabled
         -> if base.jsa can be loaded, continue execution with only base.jsa loaded

continue execution with CDS disabled





Comments
Changeset: 3e93e0b8 Author: Yumin Qi <minqi@openjdk.org> Date: 2021-12-08 16:20:39 +0000 URL: https://git.openjdk.java.net/jdk/commit/3e93e0b809f2c6cb4a466af92ec678cbc82863e4
08-12-2021