JDK-8222533 : jtreg test jdk/internal/platform/cgroup/TestCgroupMetrics.java fails on SLES12.3 linux ppc64le machine
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2019-04-16
  • Updated: 2020-10-20
  • Resolved: 2019-05-10
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
11.0.10-oracleFixed 13 b21Fixed
Description
Currently the jtreg test

jdk/internal/platform/cgroup/TestCgroupMetrics.java

fails on my linux ppc64le  test machine (SLES 12.3) .   (jdk/jdk hg)
It gives me :

java.lang.RuntimeException: Test failed for - blkio:blkio.throttle.io_service_bytes - Total, expected [25288465162240], got [158457046589440]
                at jdk.test.lib.containers.cgroup.MetricsTester.fail(MetricsTester.java:188)
                at jdk.test.lib.containers.cgroup.MetricsTester.testBlkIO(MetricsTester.java:515)
                at TestCgroupMetrics.main(TestCgroupMetrics.java:51)
                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:567)
                at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
                at java.base/java.lang.Thread.run(Thread.java:835)

The failure happens here, when a metrics value is compared with a value read from file system (oldVal/newVal).
MetricsTester.java :

    public void testBlkIO() {
        Metrics metrics = Metrics.systemMetrics();
            long oldVal = metrics.getBlkIOServiceCount();
        long newVal = getLongValueFromFile(SubSystem.BLKIO,
                "blkio.throttle.io_service_bytes", "Total");
        if (!compareWithErrorMargin(oldVal, newVal)) {
            fail(SubSystem.BLKIO, "blkio.throttle.io_service_bytes - Total",
                    oldVal, newVal);
        }

It seems the wrong values from  /sys/fs/cgroup/blkio/blkio.throttle.io_service_bytes  are compared :

fgrep Total /sys/fs/cgroup/blkio/blkio.throttle.io_service_bytes
254:6 Total 25350186577920
   ...
Total 158652998460416

Once the first value is taken , and once the last  (where the line ***starts*** with Total).
Short analysis  from B.Vandette  found that

open/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java:151
in getLongEntry, seems to do the following :

"Instead of finding the first line that starts with ���Total���, it finds the first line that contains ���Total���. "


Comments
Fix request (11u) -- will label after testing completed. I would like to downport this for parity with 11.0.10-oracle. Applies clean.
01-10-2020