RFR: 8327495: Print more warning with -Xshare:auto when CDS fails to use archive [v3]

Ioi Lam iklam at openjdk.org
Tue Apr 29 00:00:59 UTC 2025


On Mon, 28 Apr 2025 21:53:26 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> Before this change, if the `-Xshare:auto` is specified with a CDS archive, the user won't see the following error message when the archive has failed to load:
>> `An error has occurred while processing the the shared archive file.`
>> This change will print the above error message if the `-Xshare:auto` is specified and the archive is not the default one.
>> Several existing `log_ino(cds)()` calls have been changed to calling the new function `MetaspaceShared::report_loading_error()`. Also modified couple of tests to check the above error message is printed.
>> 
>> Passed tiers 1 - 3 testing.
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   @iklam comment

src/hotspot/share/cds/cdsConfig.cpp line 654:

> 652:     // message from the classlist as it interferes with the default CDS archive creation.
> 653:     return true;
> 654:   }

I check the Makefiles, and the situation you are trying to avoid is this part in make/GenerateLinkOptData.gmk:


	$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java \
	    -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
	    build.tools.classlist.SortClasslist $@.raw.4 > $@


After adding `-Xlog:cds=/tmp/foo.txt` to the above command, I get the following in the log file:


[0.004s][info][cds] trying to map /jdk3/bld/tin/support/interim-image/lib/server/classes.jsa
[0.004s][info][cds] Specified shared archive file not found (/jdk3/bld/tin/support/interim-image/lib/server/classes.jsa)
[0.004s][info][cds] An error has occurred while processing the shared archive file.
[0.004s][info][cds] Loading static archive failed.
[0.004s][error][cds] An error has occurred while processing the shared archive file.
[0.004s][error][cds] Unable to map shared spaces


I think the `!is_using_archive()` shouldn't be in this function. Instead it should be in `MetaspaceShared::report_loading_error()`:


LogStream& ls = (!CDSConfig::is_using_archive()) || CDSConfig::is_using_only_default_archive() ? ls_info : ls_error;

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24889#discussion_r2065068732


More information about the hotspot-runtime-dev mailing list