JDK-8214118 : HeapRegions marked as archive even if CDS mapping fails
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 11,12
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2018-11-20
  • Updated: 2019-05-16
  • Resolved: 2018-11-23
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 11 JDK 12
11.0.3-oracleFixed 12 b22Fixed
Related Reports
Relates :  
Relates :  
Description
Sometimes SPECjbb2015, when run with e.g. -Xmx16g Xmn12g crashes in random places.

The only commonality found so far is that it occurs after a full gc as -XX:+VerifyAfterGC fails at some point. Further, in all these cases, the klass pointer seems to reference unmapped memory, so potentially some class unloading related issue.

So far it has been tracked down to some build <= b15, b14 (and b10) seem good so far.

Reproducability in b15+ seems to be good.
Comments
The patch should or does apply cleanly? (approved contingent on appropriate codereview if necessary)
29-11-2018

Fix Request This bug makes applications that try to use CDS (which they do by default) but fail to do so crash sometime after a full gc. The patch is small and should apply cleanly.
26-11-2018

Thanks, [~tschatzl]. I created JDK-8214313.
26-11-2018

It would be nice to have it in 11, yes, as it makes use of CDS hazardous with g1.
26-11-2018

[~tschatzl] and [~sjohanss], do you think if we should consider back-porting this fix to JDK 11?
26-11-2018

[~sjohanss]Fix looks good. I've reviewed it in the open. Thanks! Indirectly related to it, I wonder what caused relocation to fail (giving a range that failed to map). [~sjohanss] and [~tschatzl] could you please shared the complete -Xlog:cds for the failed SPECjbb2015 run?
21-11-2018

JDK-8202951 added in 12b15 made CDS default, and so introduced this issue to cases like this.
20-11-2018

[~sjohanss] thinks that there is a problem when relocating the CDS archive fails, i.e. the initialization code tries to map in the archive, which during allocation of the regions sets regions as "Archive", but then failing to relocate it (e.g. `[0.191s][info][cds] UseSharedSpaces: Unable to map at required address in java heap. 0x00000007ff800000, size = 438272 bytes`, it does not correctly update these regions as regular regions again in the `G1ArchiveAllocator::_open/closed_archive_region_map`. And then bad things (tm) happen during full gc because it uses that information to e.g. marking and forwarding objects.
20-11-2018

In Shenandoah, we have the diagnostic mode to run Full GCs only, which helps to hash out these issues very early. Consider doing the same?
20-11-2018