JDK-8220579 : [Containers] SubSystem.java out of sync with osContainer_linux.cpp
  • Type: Bug
  • Component: core-svc
  • Affected Version: openjdk8u,11,13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2019-03-13
  • Updated: 2021-01-13
  • Resolved: 2019-03-18
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 Other
11.0.5Fixed 13 b13Fixed openjdk8u282Fixed
Related Reports
Blocks :  
Relates :  
Description
Setting the path for subsystems visible via -XshowSettings (Metrics.java/SubSystem.java) is out-of-sync with the logic in Hotspot's osContainer_linux.cpp

Around line 87 in osContainer_linux.cpp function set_subsystem_path() has this:

          if (strcmp(cgroup_path,"/") != 0) {
            buflen = strlen(buf);
            if ((buflen + strlen(cgroup_path)) > (MAXPATHLEN-1)) {
              return;
            }
            strncat(buf, cgroup_path, MAXPATHLEN-buflen);
            buf[MAXPATHLEN-1] = '\0';
          }
          _path = os::strdup(buf);

The same piece of code in SubSystem.java method setPath has:

                if (cgroupPath.equals("/")) {
                    path = mountPoint + cgroupPath;
                }
                else {
                    path = mountPoint;
                }

So the native code uses "'/' != cgroupPath" while the Java code has "'/' == cgroupPath".

This is an issue for implementing Metrics.java bits for JDK-8217338
Comments
Fix Request (OpenJDK 8u): Please approve this one-liner change for OpenJDK 8u. This patch is needed for JDK-8217338 to work correctly for 8u. While it's easier to test with JDK-8217338 applied too, it's an independent fix. Patch applies clean once path is changed to the 8u location. Testing: manual systemd slice with memory limit and -XshowSettings:system. Risk should be minimal.
03-11-2020

Fix Request (OpenJDK 11u): Please approve this one-liner change for OpenJDK 11. The same issue exists there and is a prerequisite for JDK-8217338. Risk is minimal.
15-07-2019

Yes.
18-06-2019

11u seems to be affected as well?
18-06-2019

Candidate webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8220579/01/webrev/
14-03-2019