-
Bug
-
Resolution: Fixed
-
P3
-
openjdk8u272, 11, 15, 16
-
b22
-
generic
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8256235 | 15u-cpu | Severin Gehwolf | P3 | Resolved | Fixed | master |
JDK-8255545 | 15.0.2 | Severin Gehwolf | P3 | Resolved | Fixed | b05 |
JDK-8258876 | 13.0.6 | Ekaterina Vergizova | P3 | Resolved | Fixed | b04 |
JDK-8256062 | 11.0.11-oracle | Dukebot | P3 | Resolved | Fixed | b01 |
JDK-8256945 | 11.0.10 | Severin Gehwolf | P3 | Resolved | Fixed | b04 |
JDK-8257597 | openjdk8u292 | Severin Gehwolf | P3 | Resolved | Fixed | b01 |
On a system with join controllers, /proc/self/cgroup, might look like this:
9:pids:/user.slice/user-1000.slice/session-2.scope
8:perf_event:/
7:blkio:/user.slice
6:rdma:/
5:cpuset:/
4:devices:/user.slice
3:cpu,cpuacct,memory,net_cls,net_prio,hugetlb:/user.slice/user-1000.slice/session-2.scope
2:freezer:/
1:name=systemd:/user.slice/user-1000.slice/session-2.scope
0::/user.slice/user-1000.slice/session-2.scope
Then, the Java code to set the path to for the controller reads:
try (Stream<String> lines =
CgroupUtil.readFilePrivileged(Paths.get("/proc/self/cgroup"))) {
lines.map(line -> line.split(":"))
.filter(line -> (line.length >= 3))
.forEach(line -> setSubSystemControllerPath(subsystem, line));
} catch (IOException e) {
return null;
}
where setSubSystemController() reads:
/**
* setSubSystemPath based on the contents of /proc/self/cgroup
*/
private static void setSubSystemControllerPath(CgroupV1Subsystem subsystem, String[] entry) {
String controllerName;
String base;
CgroupV1SubsystemController controller = null;
CgroupV1SubsystemController controller2 = null;
controllerName = entry[1];
base = entry[2];
if (controllerName != null && base != null) {
switch (controllerName) {
case "memory":
controller = subsystem.memoryController();
break;
case "cpuset":
controller = subsystem.cpuSetController();
break;
case "cpu,cpuacct":
case "cpuacct,cpu":
controller = subsystem.cpuController();
controller2 = subsystem.cpuAcctController();
break;
case "cpuacct":
controller = subsystem.cpuAcctController();
break;
case "cpu":
controller = subsystem.cpuController();
break;
case "blkio":
controller = subsystem.blkIOController();
break;
// Ignore subsystems that we don't support
default:
break;
}
}
if (controller != null) {
controller.setPath(base);
if (controller instanceof CgroupV1MemorySubSystemController) {
CgroupV1MemorySubSystemController memorySubSystem = (CgroupV1MemorySubSystemController)controller;
boolean isHierarchial = getHierarchical(memorySubSystem);
memorySubSystem.setHierarchical(isHierarchial);
boolean isSwapEnabled = getSwapEnabled(memorySubSystem);
memorySubSystem.setSwapEnabled(isSwapEnabled);
}
if (controller != null) {
controller.setPath(base);
if (controller instanceof CgroupV1MemorySubSystemController) {
CgroupV1MemorySubSystemController memorySubSystem = (CgroupV1MemorySubSystemController)controller;
boolean isHierarchial = getHierarchical(memorySubSystem);
memorySubSystem.setHierarchical(isHierarchial);
boolean isSwapEnabled = getSwapEnabled(memorySubSystem);
memorySubSystem.setSwapEnabled(isSwapEnabled);
}
subsystem.setActiveSubSystems();
}
if (controller2 != null) {
controller2.setPath(base);
}
So for the example /proc/self/cgroup file it only sets the path for "blkio" and "cpuset". Others are not correctly set because they are on a joined path.
The net effect of this is that Metrics doesn't report the container limits correctly on such systems.
- backported by
-
JDK-8255545 [cgroups v1] Metric limits not properly detected on some join controller combinations
-
- Resolved
-
-
JDK-8256062 [cgroups v1] Metric limits not properly detected on some join controller combinations
-
- Resolved
-
-
JDK-8256235 [cgroups v1] Metric limits not properly detected on some join controller combinations
-
- Resolved
-
-
JDK-8256945 [cgroups v1] Metric limits not properly detected on some join controller combinations
-
- Resolved
-
-
JDK-8257597 [cgroups v1] Metric limits not properly detected on some join controller combinations
-
- Resolved
-
-
JDK-8258876 [cgroups v1] Metric limits not properly detected on some join controller combinations
-
- Resolved
-
- relates to
-
JDK-8217766 Container Support doesn't work for some Join Controllers combinations
-
- Resolved
-
-
JDK-8253939 [TESTBUG] Increase coverage of the cgroups detection code
-
- Resolved
-
- links to
-
Commit openjdk/jdk13u-dev/cc78d10e
-
Commit openjdk/jdk/a0b687bf
-
Review openjdk/jdk13u-dev/68
-
Review openjdk/jdk/809