-
Bug
-
Resolution: Fixed
-
P3
-
11, 13
-
b13
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8251248 | 11.0.10-oracle | Evan Whelan | P3 | Resolved | Fixed | b01 |
JDK-8229300 | 11.0.5 | Bob Vandette | P3 | Resolved | Fixed | b03 |
JDK-8304493 | 8u381 | Ivan Bereziuk | P3 | Resolved | Fixed | b01 |
Some of the CPU Metrics being reported on Linux are being incorrectly reported on some Linux distributions. The cpu metrics listed below are being referenced via the cpuacct subsystem. This works in most cases due to the fact that the cpuacct and cpu subsystems are symbolically linked to the same directory. This is not the case on all Linux distributions.
The configuration where Is first discovered this problem running docker on a Mac and
running a Linux container under docker.
A suggested fix is listed below:
diff --git a/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java b/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java
--- a/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java
+++ b/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java
@@ -299,15 +299,15 @@
public long getCpuPeriod() {
- return SubSystem.getLongValue(cpuacct, "cpu.cfs_period_us");
+ return SubSystem.getLongValue(cpu, "cpu.cfs_period_us");
}
public long getCpuQuota() {
- return SubSystem.getLongValue(cpuacct, "cpu.cfs_quota_us");
+ return SubSystem.getLongValue(cpu, "cpu.cfs_quota_us");
}
public long getCpuShares() {
- long retval = SubSystem.getLongValue(cpuacct, "cpu.shares");
+ long retval = SubSystem.getLongValue(cpu, "cpu.shares");
if (retval == 0 || retval == 1024)
return -1;
else
@@ -315,15 +315,15 @@
}
public long getCpuNumPeriods() {
- return SubSystem.getLongEntry(cpuacct, "cpu.stat", "nr_periods");
+ return SubSystem.getLongEntry(cpu, "cpu.stat", "nr_periods");
}
public long getCpuNumThrottled() {
- return SubSystem.getLongEntry(cpuacct, "cpu.stat", "nr_throttled");
+ return SubSystem.getLongEntry(cpu, "cpu.stat", "nr_throttled");
}
public long getCpuThrottledTime() {
- return SubSystem.getLongEntry(cpuacct, "cpu.stat", "throttled_time");
+ return SubSystem.getLongEntry(cpu, "cpu.stat", "throttled_time");
}
The configuration where Is first discovered this problem running docker on a Mac and
running a Linux container under docker.
A suggested fix is listed below:
diff --git a/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java b/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java
--- a/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java
+++ b/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java
@@ -299,15 +299,15 @@
public long getCpuPeriod() {
- return SubSystem.getLongValue(cpuacct, "cpu.cfs_period_us");
+ return SubSystem.getLongValue(cpu, "cpu.cfs_period_us");
}
public long getCpuQuota() {
- return SubSystem.getLongValue(cpuacct, "cpu.cfs_quota_us");
+ return SubSystem.getLongValue(cpu, "cpu.cfs_quota_us");
}
public long getCpuShares() {
- long retval = SubSystem.getLongValue(cpuacct, "cpu.shares");
+ long retval = SubSystem.getLongValue(cpu, "cpu.shares");
if (retval == 0 || retval == 1024)
return -1;
else
@@ -315,15 +315,15 @@
}
public long getCpuNumPeriods() {
- return SubSystem.getLongEntry(cpuacct, "cpu.stat", "nr_periods");
+ return SubSystem.getLongEntry(cpu, "cpu.stat", "nr_periods");
}
public long getCpuNumThrottled() {
- return SubSystem.getLongEntry(cpuacct, "cpu.stat", "nr_throttled");
+ return SubSystem.getLongEntry(cpu, "cpu.stat", "nr_throttled");
}
public long getCpuThrottledTime() {
- return SubSystem.getLongEntry(cpuacct, "cpu.stat", "throttled_time");
+ return SubSystem.getLongEntry(cpu, "cpu.stat", "throttled_time");
}
- backported by
-
JDK-8229300 Wrong cgroup subsystem being used for some CPU Container Metrics
- Resolved
-
JDK-8251248 Wrong cgroup subsystem being used for some CPU Container Metrics
- Resolved
-
JDK-8304493 Wrong cgroup subsystem being used for some CPU Container Metrics
- Resolved