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

Cgroups: Incorrect detection logic on some systems

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b12

      Backports

        Description

        After JDK-8231111 there are some reports of failures on some cgroups v1 systems (e.g. SLES 11/12). In particular, systems which support cgroups v1, but don't have controllers mounted on a cgroups v1 hierarchy.

        Failure looks like:
        java.lang.InternalError: java.lang.reflect.InvocationTargetException
                        at java.base/jdk.internal.platform.Metrics.systemMetrics(Metrics.java:65)
                        at java.base/jdk.internal.platform.Container.metrics(Container.java:43)
                        at jdk.management/com.sun.management.internal.OperatingSystemImpl.<init>(OperatingSystemImpl.java:48)
                        at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl.getOperatingSystemMXBean(PlatformMBeanProviderImpl.java:281)
                        at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl$3.nameToMBeanMap(PlatformMBeanProviderImpl.java:198)
                        at java.management/sun.management.spi.PlatformMBeanProvider$PlatformComponent.getMBeans(PlatformMBeanProvider.java:195)
                        at java.management/java.lang.management.ManagementFactory.getPlatformMXBean(ManagementFactory.java:686)
                        at java.management/java.lang.management.ManagementFactory.getOperatingSystemMXBean(ManagementFactory.java:388)
                        at com.sun.javatest.regtest.config.OS.<init>(OS.java:158)
                        at com.sun.javatest.regtest.config.OS.current(OS.java:59)
                        at com.sun.javatest.regtest.config.RegressionContext.<init>(RegressionContext.java:62)
                        at com.sun.javatest.regtest.config.RegressionContext.getDefault(RegressionContext.java:45)
                        at com.sun.javatest.regtest.config.RegressionTestFinder.<init>(RegressionTestFinder.java:93)
                        at com.sun.javatest.regtest.config.RegressionTestSuite.createTestFinder(RegressionTestSuite.java:100)
                        at com.sun.javatest.regtest.config.RegressionTestSuite.<init>(RegressionTestSuite.java:82)
                        at com.sun.javatest.regtest.config.RegressionTestSuite.open(RegressionTestSuite.java:65)
                        at com.sun.javatest.regtest.config.TestManager.getTestSuites(TestManager.java:164)
                        at com.sun.javatest.regtest.tool.Tool.run(Tool.java:1076)
                        at com.sun.javatest.regtest.tool.Tool.run(Tool.java:1027)
                        at com.sun.javatest.regtest.tool.Tool.main(Tool.java:143)
                        at com.sun.javatest.regtest.Main.main(Main.java:58)
        Caused by: java.lang.reflect.InvocationTargetException
                        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 java.base/jdk.internal.platform.Metrics.systemMetrics(Metrics.java:61)
                        ... 20 more
        Caused by: java.lang.ExceptionInInitializerError
                        at java.base/jdk.internal.platform.CgroupSubsystemFactory.create(CgroupSubsystemFactory.java:94)
                        at java.base/jdk.internal.platform.CgroupMetrics.getInstance(CgroupMetrics.java:163)
                        ... 25 more
        Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 1
                        at java.base/jdk.internal.platform.cgroupv2.CgroupV2Subsystem.initSubsystem(CgroupV2Subsystem.java:71)
                        at java.base/jdk.internal.platform.cgroupv2.CgroupV2Subsystem.<clinit>(CgroupV2Subsystem.java:42)
                        ... 27 more

        The reason for this is that CgroupSubsystemFactory incorrectly detects such a system as cgroups v2

        Note:
        $ grep cgroup /proc/self/mountinfo
        <nothing>
        $ cat /proc/cgroups
        #subsys_name hierarchy num_cgroups enabled
        cpuset 0 1 1
        cpu 0 1 1
        cpuacct 0 1 1
        memory 0 1 1
        devices 0 1 1
        freezer 0 1 1
        net_cls 0 1 1
        blkio 0 1 1
        perf_event 0 1 1

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                sgehwolf Severin Gehwolf
                Reporter:
                sgehwolf Severin Gehwolf
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: