RFR: 8261455: Automatically generate the CDS archive if necessary [v2]

Ioi Lam iklam at openjdk.java.net
Mon Jan 3 07:54:13 UTC 2022


On Tue, 28 Dec 2021 03:44:50 GMT, Yumin Qi <minqi at openjdk.org> wrote:

>> This patch is re-coded after serial fixes related: 8275846, 8276787, 8279018 etc.
>> original description(PR 5997):
>> `----------------------------------------------------------------------------------`
>> When shared archive (dynamic archive) failed to map due to damage of the archive file, dump/run jdk version mismatch or non-existence file etc, the new patch will automatically create a new shared archive if -XX:+AutoCreateSharedArchive specified with the name based on SharedArchiveFile.
>> This is a revised patch based on the old PR: 5077 and after bug 8273152 integrated.
>> `-----------------------------------------------------------------------------------`
>> 
>> Tests: tier1,tier2,tier3,tier4
>> 
>> Thanks
>> Yumin
>
> Yumin Qi has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Set ArchiveClassesAtExit when AutoCreateSharedArchive is enabled

I tried switching between two builds and the VM crashes:


$ rm bar.jsa
$ /bld/fastdebug/images/jdk/bin/java -XX:+AutoCreateSharedArchive \
   -XX:SharedArchiveFile=bar.jsa -cp HelloWorld.jar HelloWorld
Java HotSpot(TM) 64-Bit Server VM warning: AutoCreateSharedArchive will be ignored for static archive
Hello World


NOTE: the warning is incorrectly printed.



$ /bld/slowdebug/images/jdk/bin/java -XX:+AutoCreateSharedArchive \
   -XX:SharedArchiveFile=bar.jsa -cp HelloWorld.jar HelloWorld
Hello World

[0.002s][info][cds] Opening shared archive: bar.jsa
[0.069s][info][cds] Opening shared archive: /bld/fastdebug/images/jdk/lib/server/classes.jsa
[0.069s][info][cds] trying to map /bld/fastdebug/images/jdk/lib/server/classes.jsa
[0.069s][info][cds] Opened archive /bld/fastdebug/images/jdk/lib/server/classes.jsa.
[0.069s][info][cds] _jvm_ident expected: Java HotSpot(TM) 64-Bit Server VM (slowdebug ....
[0.069s][info][cds]              actual: Java HotSpot(TM) 64-Bit Server VM (fastdebug ....
[0.069s][info][cds] UseSharedSpaces: The shared archive file was created by a different version or build of HotSpot
[0.069s][info][cds] UseSharedSpaces: Initialize static archive failed.
[0.069s][info][cds] UseSharedSpaces: Unable to map shared spaces
Hello World
[1.048s][info][cds] Regenerate MethodHandle Holder classes...
[1.048s][info][cds] Nothing to regenerate for holder classes
[1.048s][info][cds] Regenerate MethodHandle Holder classes...done
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/arguments.hpp:647
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/jdk2/sek/open/src/hotspot/share/runtime/arguments.hpp:647), pid=2165765, tid=2165766
#  assert(Arguments::is_dumping_archive()) failed: dump time only


I think you can test this by:

- create a static archive s.jsa
- create a dynamic archive d.jsa base on s.jsa
- corrupt the _jvm_ident of s.jsa
- run with -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=s.jsa:d.jsa ...

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

PR: https://git.openjdk.java.net/jdk/pull/6920


More information about the hotspot-runtime-dev mailing list