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

Fix of JDK-8287107 (unused cgv1 freezer controller) was incomplete

XMLWordPrintable

    • b26
    • generic
    • linux

        The change of JDK-8287107 failed to fix the hotspot code :( There, the cgroup path would happily set all controllers to the path of a cgroups v1 controller if it so happens that it is being listed *after* the cgroups v2 one.

        Example:

        $ cat /proc/self/cgroup
        0::/foobar
        11:freezer:/cg1

        The cgroup path would end up being '/cg1' instead of '/foobar'. This can be fairly easy to reproduce with this patch:

        diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp
        index 1346cf8915f..7b93e0d5721 100644
        --- a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp
        +++ b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp
        @@ -261,6 +261,8 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
             }
             if (is_cgroupsV2) {
               for (int i = 0; i < CG_INFO_LENGTH; i++) {
        + assert(hierarchy_id == cg_infos[i]._hierarchy_id, "/proc/cgroups (%d) and /proc/self/cgroup (%d) hierarchy mismatch",
        + cg_infos[i]._hierarchy_id, hierarchy_id);
                 cg_infos[i]._cgroup_path = os::strdup(cgroup_path);
               }
             }

        And running on a fastdebug build:
        $ make LOG=debug test TEST="jtreg:test/hotspot/jtreg/containers/cgroup/CgroupSubsystemFactory.java"

        It asserts with:

        # To suppress the following error report, specify this argument
        # after -XX: or in .hotspotrc: SuppressErrorAt=/cgroupSubsystem_linux.cpp:264
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/disk/openjdk/upstream-sources/git/jdk-jdk/src/hotspot/os/linux/cgroupSubsystem_linux.cpp:264), pid=134644, tid=134666
        # assert(hierarchy_id == cg_infos[i]._hierarchy_id) failed: /proc/cgroups (0) and /proc/self/cgroup (11) hierarchy mismatch
        #
        # JRE version: OpenJDK Runtime Environment (19.0) (fastdebug build 19-internal-adhoc.sgehwolf.jdk-jdk)
        # Java VM: OpenJDK 64-Bit Server VM (fastdebug 19-internal-adhoc.sgehwolf.jdk-jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
        # Problematic frame:
        # V [libjvm.so+0x95a67c] CgroupSubsystemFactory::determine_type(CgroupInfo*, char const*, char const*, char const*, unsigned char*)+0xd4c

              sgehwolf Severin Gehwolf
              sgehwolf Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: