JDK-8279997 : check_for_dynamic_dump should not exit vm
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 19
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-01-14
  • Updated: 2022-02-15
  • Resolved: 2022-02-11
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 19
19 masterFixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Before JDK-8261455:

$ rm -f base.jsa
$ java -XX:SharedArchiveFile=base.jsa -XX:ArchiveClassesAtExit=top.jsa -version
Error occurred during initialization of VM
-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.

$ java -Xshare:dump -XX:SharedArchiveFile=base.jsa
$ java -XX:+UseZGC -XX:SharedArchiveFile=base.jsa -XX:ArchiveClassesAtExit=top.jsa -version
Error occurred during initialization of VM
-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.

===========================================
After JDK-8261455, the behavior becomes inconsistent:

$ rm -f base.jsa
$ java -XX:SharedArchiveFile=base.jsa -XX:ArchiveClassesAtExit=top.jsa -version
Error occurred during initialization of VM
-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.

$ java -Xshare:dump -XX:SharedArchiveFile=base.jsa
$ java -XX:+UseZGC -XX:SharedArchiveFile=base.jsa -XX:ArchiveClassesAtExit=top.jsa -version
java version "19-internal" 2022-09-20
Java(TM) SE Runtime Environment (build 19-internal+0-adhoc.iklam.open)
Java HotSpot(TM) 64-Bit Server VM (build 19-internal+0-adhoc.iklam.open, mixed mode)

Comments
Changeset: e75e8cd7 Author: Yumin Qi <minqi@openjdk.org> Date: 2022-02-11 16:42:07 +0000 URL: https://git.openjdk.java.net/jdk/commit/e75e8cd708ed478eda08c4a5c724e7e82f57d36e
11-02-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7433 Date: 2022-02-10 20:40:31 +0000
10-02-2022

With whatever the reason base archive failed: if (archives == 1) { char* base_archive_path = NULL; bool success = FileMapInfo::get_base_archive_name_from_header(SharedArchiveFile, &base_archive_path); if (!success) { // If +AutoCreateSharedArchive and the specified shared archive does not exist, // regenerate the dynamic archive base on default archive. if (AutoCreateSharedArchive && !os::file_exists(SharedArchiveFile)) { DynamicDumpSharedSpaces = true; ArchiveClassesAtExit = const_cast<char *>(SharedArchiveFile); SharedArchivePath = get_default_shared_archive_path(); SharedArchiveFile = nullptr; } else { no_shared_spaces(“invalid archive”); <------ not success we reached here. } Since it is !RequireSharedSpaces, UseSharedSpaces set to false there and continue. But this caused check_for_dynamic_dump exit. We should not exit if neither -XX:AutoCreateSharedArchive nor -XX:ArchiveClassesAtExit is specified.
09-02-2022

If the base archive cannot be mapped with -Xshare:auto, the current policy of the CDS warning message is: - By default, we continue execution without print any warnings. Otherwise, the user will see a lot of warnings when running with JVM flags that are incompatible with the two default CDS archives, or with the CDS archive specified via -XX:SharedArchiveFile. If the user really wants to know what's happening, they can specify -Xlog:cds. - However, if -XX:AutoCreateSharedArchive or -XX:ArchiveClassesAtExit are specified, we print a warning, so that it's clear to the user that the requested archive cannot be created.
08-02-2022

This behavior is same a 8280353. -Xshare:auto is the default in command line unless user specify -Xshare:on to force to load CDS. With auto mode, if mapping shared archive failed --- the program should go without sharing. The case not limited to UseZGC. if CDS failed to load under 'auto' mode, we should print out warning and let the program continue without sharing.
07-02-2022

ILW = MMM = P3
18-01-2022