RFR: 8255917: runtime/cds/SharedBaseAddress.java failed "assert(reserved_rgn != 0LL) failed: No reserved region" [v4]
Ioi Lam
iklam at openjdk.java.net
Tue Dec 8 20:02:33 UTC 2020
On Tue, 8 Dec 2020 19:20:17 GMT, Yumin Qi <minqi at openjdk.org> wrote:
>> The new test case can be something like this:
>>
>> $ java -XX:DumpLoadedClassList=HelloWorld.classlist -cp HelloWorld.jar HelloWorld
>> Hello World
>> $ java -Xshare:dump -XX:SharedClassListFile=HelloWorld.classlist -cp HelloWorld.jar \
>> -XX:SharedArchiveFile=tmp.jsa -XX:SharedBaseAddress=0
>> $ touch XXX.jar
>> $ java -Xshare:auto -XX:SharedArchiveFile=tmp.jsa -cp XXX.jar:HelloWorld.jar -Xlog:cds \
>> -showversion HelloWorld
>> ...
>> [0.034s][info][cds] Archive(s) were created with -XX:SharedBaseAddress=0. Always map at os-selected address.
>> [0.034s][info][cds] Try to map archive(s) at an alternative address
>> [0.034s][info][cds] Mapped static region #0 at base 0x00007f21f7800000 top 0x00007f21f7806000 (MiscCode)
>> [0.034s][info][cds] Mapped static region #1 at base 0x00007f21f7806000 top 0x00007f21f7a1d000 (ReadWrite)
>> [0.034s][info][cds] Mapped static region #2 at base 0x00007f21f7a1d000 top 0x00007f21f7daf000 (ReadOnly)
>> [0.048s][info][cds] UseSharedSpaces: shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)
>> [0.048s][info][cds] Unmapping region #0 at base 0x00007f21f7800000 (MiscCode)
>> [0.048s][info][cds] Unmapping region #1 at base 0x00007f21f7806000 (ReadWrite)
>> [0.048s][info][cds] Unmapping region #2 at base 0x00007f21f7a1d000 (ReadOnly)
>> [0.048s][info][cds] UseSharedSpaces: Unable to map shared spaces
>> java version "16-internal" 2021-03-16
>> Java(TM) SE Runtime Environment (slowdebug build 16-internal+0-adhoc.iklam.open)
>> Java HotSpot(TM) 64-Bit Server VM (slowdebug build 16-internal+0-adhoc.iklam.open, mixed mode)
>> Hello World
>> You can set a breakpoint at `MetaspaceShared::release_reserved_spaces()` to make sure it's called with `total_rs`.
>>
>> Note that `-Xshare:auto` must be used.
>>
>> If `-Xshare:on` is used, the VM will exit immediately without calling `MetaspaceShared::release_reserved_spaces()`. Most of the CDS tests are executed with `-Xshare:on`. That's why we didn't see the assert on Windows with Yumin's earlier patch -- in Mach5 tier 4, we run test/hotspot/jtreg/runtime/cds/appcds/BootClassPathMismatch.java with `-XX:ArchiveRelocationMode=1`, but the test itself would use with `-Xshare:on`.
>
> When jar mismatched, say, -cp non-exist.jar (We could not use -cp no-exitst.jar:hello.jar since, once hello.jar the dump time jar found and matched, the non-exist.jar will be ignored, test showed it is OK), the output:
> [0.035s][info ][cds] Mapped static region #0 at base 0x00007f98e3800000 top 0x00007f98e3806000 (MiscCode)
> [0.035s][info ][cds] Mapped static region #1 at base 0x00007f98e3806000 top 0x00007f98e3a1e000 (ReadWrite)
> [0.035s][info ][cds] Mapped static region #2 at base 0x00007f98e3a1e000 top 0x00007f98e3db2000 (ReadOnly)
> [0.049s][info ][cds] UseSharedSpaces: shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)
> [0.049s][info ][cds] Unmapping region #0 at base 0x00007f98e3800000 (MiscCode)
> [0.049s][info ][cds] Unmapping region #1 at base 0x00007f98e3806000 (ReadWrite)
> [0.049s][info ][cds] Unmapping region #2 at base 0x00007f98e3a1e000 (ReadOnly)
> [0.049s][debug][cds] Released shared space 0x00007f98e3800000
> [0.049s][debug][cds] Released shared space (archive + class) 0x00007f98e3800000
> [0.049s][info ][cds] UseSharedSpaces: Unable to map shared spaces
>
> The repeat will be eliminated next version from here:
> 1489 } else {
> 1490 unmap_archive(static_mapinfo);
> 1491 unmap_archive(dynamic_mapinfo);
> 1492 log_debug(cds)("Released shared space " INTPTR_FORMAT, p2i(total_space_rs.base()));
> 1493 release_reserved_spaces(total_space_rs, archive_space_rs, class_space_rs);
> 1494 }
You're correct that if you use `-cp non-exist.jar:hello.jar`, the non-exist.jar will be ignored because it doesn't exist, and CDS will not treat the classpath as a mismatch.
However, in my example, I created the XXX.jar file, so CDS will treat the classpath as a mismatch.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1657
More information about the hotspot-runtime-dev
mailing list