JDK-8256079 : Heterogeneous Heap may fail silently on Windows
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 12,13,14,15
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2020-11-10
  • Updated: 2020-11-13
  • Resolved: 2020-11-13
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
https://github.com/openjdk/jdk/blob/f71f9dc93a6963ce36953e0ad770edd761afd0b4/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp#L87

When JDK-8202286 (Allocation of old generation of Java heap on alternate memory devices) is enabled, we call ReservedSpace::first_part with (split == true). 

ReservedSpace::first_part() calls os::split_reserved_memory, which, on Windows, would release the space and try to reserve it again as two spaces. However, due to change in overall system memory pressure, the reservation attempts may fail.

https://github.com/openjdk/jdk/blob/1332ba3c3c168d9fa368338e451c8c20a4c47ccc/src/hotspot/share/memory/virtualspace.cpp#L258

ReservedSpace ReservedSpace::first_part(size_t partition_size, size_t alignment, bool split) {
  assert(partition_size <= size(), "partition failed");
  if (split && partition_size > 0 && partition_size < size()) {
    os::split_reserved_memory(base(), size(), partition_size);
  }
  ReservedSpace result(base(), partition_size, alignment, special(),
                       executable());
  return result;
}

https://github.com/openjdk/jdk/blob/1332ba3c3c168d9fa368338e451c8c20a4c47ccc/src/hotspot/os/windows/os_windows.cpp#L3120

void os::split_reserved_memory(char *base, size_t size, size_t split) {
   ...
  release_memory(base, size);
  attempt_reserve_memory_at(base, split);
  attempt_reserve_memory_at(split_address, size - split);
Comments
Oracle will not fix this because the corresponding functionality has been removed in JDK-8256181.
13-11-2020

Heterogeneous heap functionality has been removed in JDK-8256181.
13-11-2020

We are planning to remove the heterogeneous heap functionality with JDK-8256181, so this issue will likely be closed later.
11-11-2020

Note: JDK-8255917 has the same underlying cause as this bug, but we can work around it by changing how CDS allocates the compressed class space on Windows.
10-11-2020

This part in G1 is also suspicious: https://github.com/openjdk/jdk/blob/f71f9dc93a6963ce36953e0ad770edd761afd0b4/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp#L257 bool G1RegionToHeteroSpaceMapper::initialize() { // Since we need to re-map the reserved space - 'Xmx' to nv-dimm and 'Xmx' to dram, we need to release the reserved memory first. // Because on some OSes (e.g. Windows) you cannot do a file mapping on memory reserved with regular mapping. os::release_memory(_rs.base(), _rs.size()); // First half of size Xmx is for nv-dimm. ReservedSpace rs_nvdimm = _rs.first_part(MaxHeapSize); assert(rs_nvdimm.base() == _rs.base(), "We should get the same base address");
10-11-2020