JDK-8236617 : jtreg test containers/docker/TestMemoryAwareness.java fails after 8226575
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2020-01-02
  • Updated: 2020-12-04
  • Resolved: 2020-01-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 11 JDK 13 JDK 14 JDK 15
11.0.10-oracleFixed 13.0.6Fixed 14Fixed 15 b06Fixed
Related Reports
Relates :  
Relates :  
Relates :  
After change
8226575: OperatingSystemMXBean should be made container aware
we observe failures on linux s390x / ppc64le  in the docker related jtreg test

The test runs into
java.lang.RuntimeException: 'OperatingSystemMXBean.getTotalSwapSpaceSize: 52428800' missing from stdout/stderr 

	at jdk.test.lib.process.OutputAnalyzer.shouldContain(OutputAnalyzer.java:187)
	at TestMemoryAwareness.testOperatingSystemMXBeanAwareness(TestMemoryAwareness.java:154)
	at TestMemoryAwareness.main(TestMemoryAwareness.java:65)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	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.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:832)

Reason is that  the value found is instead :
OperatingSystemMXBean.getTotalSwapSpaceSize: -104857600

When looking into the getTotalSwapSpaceSize() function,  we  get values of  0 for "limit" and 104857600 for "memLimit" :

57            long limit = containerMetrics.getMemoryAndSwapLimit();
62            long memLimit = containerMetrics.getMemoryLimit();
63            if (limit >= 0 && memLimit >= 0) {
64                return limit - memLimit;
65            }

That explains the value "-104857600" .   We see messages that  "Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap"  , this most likely
causes the unexpected limit == 0 .

Fix request (13u) Requesting backport to 13u as follow-up fix for JDK-8226575 that is already included to 13u. Minor adjustments needed to apply the patch. Tested with container tests, the affected test passed. RFR: http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-November/004259.html

Fix Request (OpenJDK 11u): Please approve this fix as a follow-up for JDK-8226575. The intention is to push it together. The patch didn't apply as-is since the 11u backport of JDK-8226575 didn't introduce new methods. Hence the output of CheckOperatingSystemMBean is slightly different. Patch has been reviewed by Andrew Dinn. Testing: Container tests (though, not on an affected system). RFR: http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-July/003496.html webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8236617/jdk11/01/webrev/

URL: https://hg.openjdk.java.net/jdk/jdk/rev/ab10165b4141 User: jwilhelm Date: 2020-01-15 19:45:01 +0000