CSR :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
JDK-8224764 :
|
|
JDK-8226901 :
|
ADDITIONAL SYSTEM INFORMATION : Linux, as provided by the openjdk docker image `openjdk:11-jre` A DESCRIPTION OF THE PROBLEM : When Java container ergonomic options are used to set MaxHeapSize, they are unable to scale beyond a container of 128GB of RAM. For instance, when running `docker run -m200g -it --rm openjdk:11-jre java -XX:-UseCompressedOops -XX:MaxRAMPercentage=50 -version` Java only allocates a 64GB heap (50% of 128GB limit). This appears to be due lines 1733-1735 of `src/hotspot/share/runtime/arguments.cpp`, where the effective physical memory is calculated as the minimum of the reported physical memory (in this case from the container limits) and the default value of MaxRAM (128GB): ``` julong phys_mem = FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM) : (julong)MaxRAM; ``` STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : docker run -m256g -it --rm openjdk:11-jre java -XX:-UseCompressedOops -XX:MaxRAMPercentage=100 -XshowSettings:vm -version EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - VM settings: Max. Heap Size (Estimated): 256.00G Using VM: OpenJDK 64-Bit Server VM openjdk version "11.0.2" 2019-01-15 OpenJDK Runtime Environment (build 11.0.2+9-Debian-3bpo91) OpenJDK 64-Bit Server VM (build 11.0.2+9-Debian-3bpo91, mixed mode) ACTUAL - VM settings: Max. Heap Size (Estimated): 128.00G Using VM: OpenJDK 64-Bit Server VM openjdk version "11.0.2" 2019-01-15 OpenJDK Runtime Environment (build 11.0.2+9-Debian-3bpo91) OpenJDK 64-Bit Server VM (build 11.0.2+9-Debian-3bpo91, mixed mode) CUSTOMER SUBMITTED WORKAROUND : When you know you're running in docker, you can set MaxRAM yourself using -XX:MaxRAM=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes) FREQUENCY : always
|