JDK-8253098 : Disable archived module graph if CDS heap cannot be mapped
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2020-09-14
  • Updated: 2024-11-22
  • Resolved: 2020-09-15
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 16
16 b16Fixed
Related Reports
Relates :  
Description
This blocks testing of other fixes, so P1.

Example failure:

$ CONF=linux-x86_64-server-fastdebug make images run-test TEST=runtime/CompressedOops/CompressedClassPointers.java
...
[0.032s][trace][gc,metaspace] node @0x00007f1308180020: reserved=8192.00 KB, committed=0.00 KB (  0%), used=0.00 KB (  0%)
[0.032s][trace][gc,metaspace]    [0x00007f12dc1e8000, 0x00007f12dc1e8000, 0x00007f12dc1e8000, 0x00007f12dc9e8000)
[0.032s][info ][gc,metaspace] CDS archive(s) mapped at: [0x0000000800000000-0x0000000800b9a000-0x0000000800b9a000), size 12165120, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 0.
[0.032s][info ][gc,metaspace] Compressed class space mapped at: 0x0000000800b9c000-0x0000000840b9c000, size: 1073741824
[0.032s][info ][gc,metaspace] Narrow klass base: 0x0000000800000000, Narrow klass shift: 3, Narrow klass range: 0x100000000
[0.032s][info ][cds         ] use_full_module_graph = true; java.base = 0x00000008004492f0
Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Module java.management is already defined
];
 stderr: []
 exitValue = 1

java.lang.RuntimeException: Expected to get exit value of [0]

	at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAnalyzer.java:457)
	at CompressedClassPointers.largePagesForHeapTest(CompressedClassPointers.java:120)
	at CompressedClassPointers.main(CompressedClassPointers.java:313)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:832)

Bisection points to JDK-8244778:

03a4df0acd103702e52dcd01c3f03fda4d7b04f5 is the first bad commit
commit 03a4df0acd103702e52dcd01c3f03fda4d7b04f5
Author: Ioi Lam <iklam@openjdk.org>
Date:   Sun Sep 13 14:45:12 2020 +0000

    8244778: Archive full module graph in CDS


JDK-8253079 and JDK-8253081 are probably related.
Comments
Changeset: 70cc7fc1 Author: Ioi Lam <iklam@openjdk.org> Date: 2020-09-15 02:37:19 +0000 URL: https://git.openjdk.java.net/jdk/commit/70cc7fc1
15-09-2020

The log confirms the cause of the failure: CDS heap region is not mapped, but full module graph (which depends on the CDS heap region) remains enabled stdout: [[0.027s][info][cds] trying to map /home/shade/temp/jdk/jdk/build/linux-x86_64-server-fastdebug/images/jdk/lib/server/classes.jsa [0.027s][info][cds] Opened archive /home/shade/temp/jdk/jdk/build/linux-x86_64-server-fastdebug/images/jdk/lib/server/classes.jsa. [0.027s][info][cds] Archive was created with UseCompressedOops = 1, UseCompressedClassPointers = 1 [0.027s][debug][cds] Reserved archive_space_rs [0x0000000800000000 - 0x0000000800b9c000] (12173312) bytes [0.027s][debug][cds] Reserved class_space_rs [0x0000000800b9c000 - 0x0000000840b9c000] (1073741824) bytes [0.027s][info ][cds] Mapped static region #0 at base 0x0000000800000000 top 0x0000000800007000 (MiscCode) [0.027s][info ][cds] Mapped static region #1 at base 0x0000000800007000 top 0x0000000800450000 (ReadWrite) [0.027s][info ][cds] Mapped static region #2 at base 0x0000000800450000 top 0x0000000800b9a000 (ReadOnly) [0.027s][trace][gc,metaspace] node @0x00007f4fc817fac0: reserved=1048576.00 KB, committed=0.00 KB ( 0%), used=0.00 KB ( 0%) [0.027s][trace][gc,metaspace] [0x0000000800b9c000, 0x0000000800b9c000, 0x0000000800b9c000, 0x0000000840b9c000) [0.027s][info ][cds ] CDS archive was created with max heap size = 128M, and the following configuration: [0.027s][info ][cds ] narrow_klass_base = 0x0000000800000000, narrow_klass_shift = 3 [0.027s][info ][cds ] narrow_oop_mode = 0, narrow_oop_base = 0x0000000000000000, narrow_oop_shift = 0 [0.027s][info ][cds ] The current max heap size = 128M, HeapRegion::GrainBytes = 1048576 [0.027s][info ][cds ] narrow_klass_base = 0x0000000800000000, narrow_klass_shift = 3 [0.027s][info ][cds ] narrow_oop_mode = 0, narrow_oop_base = 0x0000000000000000, narrow_oop_shift = 0 [0.027s][info ][cds ] CDS heap data relocation delta = 0 bytes [0.027s][info ][cds ] Trying to map heap data: region[4] at 0x00000000fff00000, size = 507904 bytes [0.027s][info ][cds ] UseSharedSpaces: Unable to map at required address in java heap. 0x00000000fff00000, size = 507904 bytes [0.027s][info ][cds ] optimized module handling: enabled [0.027s][info ][cds ] full module graph: enabled [0.027s][trace][gc,metaspace] node @0x00007f4fc8180060: reserved=8192.00 KB, committed=0.00 KB ( 0%), used=0.00 KB ( 0%) [0.027s][trace][gc,metaspace] [0x00007f4f97800000, 0x00007f4f97800000, 0x00007f4f97800000, 0x00007f4f98000000) [0.027s][info ][gc,metaspace] CDS archive(s) mapped at: [0x0000000800000000-0x0000000800b9a000-0x0000000800b9a000), size 12165120, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 0. [0.027s][info ][gc,metaspace] Compressed class space mapped at: 0x0000000800b9c000-0x0000000840b9c000, size: 1073741824 [0.027s][info ][gc,metaspace] Narrow klass base: 0x0000000800000000, Narrow klass shift: 3, Narrow klass range: 0x100000000 [0.028s][info ][cds ] use_full_module_graph = true; java.base = 0x00000008004492f0 Error occurred during initialization of boot layer java.lang.LayerInstantiationException: Module java.management is already defined ];
14-09-2020

Ioi: Adding MetaspaceShared::disable_full_module_graph() at FileMapInfo::map_heap_regions() where you asked helps to pass at least runtime/CompressedOops/CompressedClassPointers.java. I have not tested anything else.
14-09-2020

.jtr file uploaded as attachment.
14-09-2020

[~shade] Please try this and see if it works for you void FileMapInfo::map_heap_regions() { if (has_heap_regions()) { map_heap_regions_impl(); } if (!HeapShared::closed_archive_heap_region_mapped()) { assert(closed_archive_heap_ranges == NULL && num_closed_archive_heap_ranges == 0, "sanity"); } if (!HeapShared::open_archive_heap_region_mapped()) { assert(open_archive_heap_ranges == NULL && num_open_archive_heap_ranges == 0, "sanity"); + MetaspaceShared::disable_full_module_graph(); <<<< ADD } }
14-09-2020

[~shade] Could you manually execute the last command-line that failed in the test (see the ,jtr file), and upload the entire VM output? It might have something to do with the specific amount of RAM on your test host.
14-09-2020

To test my sanity, I just: *) cloned the fresh openjdk/jdk: $ git describe jdk-16+15-35-g9c24a5635ee *) configured it with my usual: --with-debug-level=fastdebug --with-boot-jdk=/home/shade/Install/jdk14-ea/ --with-jtreg=/home/shade/Install/jtreg --disable-precompiled-headers --with-native-debug-symbols=internal --with-gtest=/home/shade/Install/googletest-release-1.8.1/ Tools summary: * Boot JDK: openjdk version "14-testing" 2020-03-17 OpenJDK Runtime Environment (build 14-testing+0-builds.shipilev.net-openjdk-jdk14-b40-20200116) OpenJDK 64-Bit Server VM (build 14-testing+0-builds.shipilev.net-openjdk-jdk14-b40-20200116, mixed mode, sharing) (at /home/shade/Install/jdk14-ea) * Toolchain: gcc (GNU Compiler Collection) * C Compiler: Version 9.3.0 (at /usr/bin/gcc) * C++ Compiler: Version 9.3.0 (at /usr/bin/g++) *) ran the same test line: $ CONF=linux-x86_64-server-fastdebug make images run-test TEST=runtime/CompressedOops/CompressedClassPointers.java And it failed exactly like described here. At this point I would suspect Mach5 is doing something else.
14-09-2020

Just FYI... I'm not seeing any Tier1 failures in Mach5 here at Oracle.
14-09-2020