RFR(oneliner): TestMemoryAwareness Docker container fails with too small maximum heap

Robbin Ehn robbin.ehn at oracle.com
Thu Mar 1 09:05:30 UTC 2018

Hi all, please review.

A regression from:
8197408: Bad pointer comparison and small cleanup in os_linux.cpp

Bug: https://bugs.openjdk.java.net/browse/JDK-8198833

Bob supplied fixed and tested it in docker environment, thanks!

diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -203,7 +203,7 @@
      jlong mem_limit;
      if ((mem_limit = OSContainer::memory_limit_in_bytes()) > 0) {
        log_trace(os)("total container memory: " JLONG_FORMAT, mem_limit);
-      return phys_mem;
+      return mem_limit;
      log_debug(os, container)("container memory limit %s: " JLONG_FORMAT ", using host value",
                              mem_limit == OSCONTAINER_ERROR ? "failed" : "unlimited", mem_limit);

 >With this fix, all the tests now pass:
 >Directory "JTwork" not found: creating
 >Passed: runtime/containers/cgroup/PlainRead.java
 >Passed: runtime/containers/docker/DockerBasicTest.java
 >Passed: runtime/containers/docker/TestCPUAwareness.java
 >Passed: runtime/containers/docker/TestCPUSets.java
 >Passed: runtime/containers/docker/TestMemoryAwareness.java
 >Passed: runtime/containers/docker/TestMisc.java
 >Test results: passed: 6

(mach5 can't run docker test at this moment)

Passes hs-tier1 and manually tested unlimited container:

[0.004s][trace][os,container] Memory Limit is: 9223372036854771712
[0.004s][trace][os,container] Memory Limit is: Unlimited
[0.004s][debug][os,container] container memory limit unlimited: -1, using host value
[0.004s][trace][os          ] total system memory: 33648091136

Thanks Robbin

More information about the hotspot-runtime-dev mailing list