Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8221340

[TESTBUG] TestCgroupMetrics.java fails after fix for JDK-8219562

    Details

    • Resolved In Build:
      b21

      Backports

        Description

        Change were made in JDK-8219562 to osContainer_linux.cpp to correct the parsing of of the /proc/self/mountinfo file but corresponding changes to the Metrics API and Container tests need to be done to match this change.

        Here is a proposed fix:

        diff --git a/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java b/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java
        --- a/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java
        +++ b/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java
        @@ -60,7 +60,7 @@
                             path = mountPoint;
                         }
                         else {
        - if (root.indexOf(cgroupPath) == 0) {
        + if (cgroupPath.indexOf(root) == 0) {
                                 if (cgroupPath.length() > root.length()) {
                                     String cgroupSubstr = cgroupPath.substring(root.length());
                                     path = mountPoint + cgroupSubstr;
        diff --git a/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java b/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java
        --- a/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java
        +++ b/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java
        @@ -85,7 +85,7 @@
                         String mountPoint = paths[1];
                         if (root != null && cgroupPath != null) {
                             if (root.equals("/")) {
        - if (cgroupPath.equals("/")) {
        + if (!cgroupPath.equals("/")) {
                                     finalPath = mountPoint + cgroupPath;
                                 } else {
                                     finalPath = mountPoint;
        @@ -94,7 +94,7 @@
                                 if (root.equals(cgroupPath)) {
                                     finalPath = mountPoint;
                                 } else {
        - if (root.indexOf(cgroupPath) == 0) {
        + if (cgroupPath.indexOf(root) == 0) {
                                         if (cgroupPath.length() > root.length()) {
                                             String cgroupSubstr = cgroupPath.substring(root.length());
                                             finalPath = mountPoint + cgroupSubstr;
        @@ -103,7 +103,7 @@
                                 }
                             }
                         }
        - subSystemPaths.put(subSystem, new String[]{finalPath});
        + subSystemPaths.put(subSystem, new String[]{finalPath, mountPoint});
                     }
                 }
             }

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  bobv Bob Vandette
                  Reporter:
                  bobv Bob Vandette
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: