JDK-8333967 : containers/cgroup/PlainRead.java fails after 8302744
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 23,24
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: linux
  • CPU: generic
  • Submitted: 2024-06-11
  • Updated: 2024-07-01
  • Resolved: 2024-07-01
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.
Other
tbdResolved
Related Reports
Relates :  
Relates :  
Sub Tasks
JDK-8334222 :  
Description
On Linux x86_64 and Linux aarch64 we see after JDK-8302744 (starting 30th May) the test containers/cgroup/PlainRead.java failing.
Seems some output/logging has been adjusted with this change.

Example stderr for test failure, do you think it is related ? Before the test was running fine.
stderr
---- snip ---------------
Thu May 30 02:29:44 CEST 2024

 stdout: [[0.000s][trace][os,container] OSContainer::init: Initializing Container Support
[0.001s][debug][os,container] Detected optional pids controller entry in /proc/cgroups
[0.001s][debug][os,container] Detected cgroups v2 unified hierarchy
[0.001s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/cpu.max
[0.001s][debug][os,container] Open of file /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/cpu.max failed, No such file or directory
[0.001s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/cpu.max
[0.001s][debug][os,container] Open of file /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/cpu.max failed, No such file or directory
[0.001s][trace][os,container] CPU Period failed: -2
[0.001s][trace][os,container] OSContainer::active_processor_count: 16
[0.001s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 16
[0.001s][trace][os,container] total physical memory: 33631973376
[0.001s][trace][os,container] Path to /memory.max is /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/memory.max
[0.001s][trace][os,container] Memory Limit is: -1
[0.001s][debug][os,container] container memory limit unlimited: -1, using host value 33631973376
[0.003s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 16
[0.112s][trace][os,container] total physical memory: 33631973376
[0.112s][trace][os,container] Path to /memory.max is /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/memory.max
[0.112s][trace][os,container] Memory Limit is: -1
[0.112s][debug][os,container] container memory limit unlimited: -1, using host value 33631973376
[0.203s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/cpu.max
[0.203s][debug][os,container] Open of file /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/cpu.max failed, No such file or directory
[0.203s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/cpu.max
[0.203s][debug][os,container] Open of file /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/cpu.max failed, No such file or directory
[0.203s][trace][os,container] CPU Period failed: -2
[0.203s][trace][os,container] OSContainer::active_processor_count: 16
[0.314s][trace][os,container] total physical memory: 33631973376
[0.314s][trace][os,container] Path to /memory.max is /sys/fs/cgroup/user.slice/user-3670.slice/session-1002.scope/memory.max
[0.314s][trace][os,container] Memory Limit is: -1
[0.314s][debug][os,container] container memory limit unlimited: -1, using host value 33631973376
];
 stderr: [openjdk version "23-internal" 2024-05-30
OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.jenkinsi.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.jenkinsi.jdk, mixed mode, sharing)
]
 exitValue = 0

java.lang.RuntimeException: '^.*CPU Quota is: *(\d+|-1|-2|Unlimited).*$' missing from stdout/stderr
at jdk.test.lib.process.OutputAnalyzer.shouldMatch(OutputAnalyzer.java:371)
at PlainRead.match(PlainRead.java:43)
at PlainRead.isContainer(PlainRead.java:57)
at PlainRead.main(PlainRead.java:75)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1575)

JavaTest Message: Test threw exception: java.lang.RuntimeException: '^.*CPU Quota is: *(\d+|-1|-2|Unlimited).*$' missing from stdout/stderr
JavaTest Message: shutting down test
Comments
JDK-8261242 has been integrated and the PlainRead.java test is no longer there. Closing as won't do.
01-07-2024

> If this will be resolved anyway with 8261242 , we can temporary exclude it on our side - do you think this is the way to go ? IMO, yes. Hopefully we can integrate JDK-8261242 soon. I don't see the point of this PlainRead.java test to be honest.
13-06-2024

Hi Severin >The test will change with JDK-8261242 (basically removes all this matching) If this will be resolved anyway with 8261242 , we can temporary exclude it on our side - do you think this is the way to go ?
13-06-2024

Output on a machine that *has* the cpu controller configured on cgroups v2: ----------------------------- $ ./jdk-23+25/bin/java -Xlog:os+container=trace --version [0.001s][trace][os,container] OSContainer::init: Initializing Container Support [0.002s][debug][os,container] Detected optional pids controller entry in /proc/cgroups [0.002s][debug][os,container] Detected cgroups v2 unified hierarchy [0.002s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-1.scope/cpu.max [0.002s][trace][os,container] CPU Quota is: -1 [0.002s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-1.scope/cpu.max [0.002s][trace][os,container] CPU Period is: 100000 [0.002s][trace][os,container] OSContainer::active_processor_count: 6 [0.002s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 6 [0.002s][trace][os,container] total physical memory: 6207635456 [0.002s][trace][os,container] Path to /memory.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-1.scope/memory.max [0.002s][trace][os,container] Memory Limit is: -1 [0.002s][debug][os,container] container memory limit unlimited: -1, using host value 6207635456 [0.003s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 6 [0.025s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-1.scope/cpu.max [0.025s][trace][os,container] CPU Quota is: -1 [0.025s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-1.scope/cpu.max [0.025s][trace][os,container] CPU Period is: 100000 [0.025s][trace][os,container] OSContainer::active_processor_count: 6 [0.030s][trace][os,container] total physical memory: 6207635456 [0.030s][trace][os,container] Path to /memory.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-1.scope/memory.max [0.030s][trace][os,container] Memory Limit is: -1 [0.030s][debug][os,container] container memory limit unlimited: -1, using host value 6207635456 ----------------------------- "CPU Quota is:" lines are there, since the cpu.max files are there (no "No such file or directory" errors).
12-06-2024

Compare that to a cgroups v2 system which doesn't have the cpu controller set up (default): -------------------------- $ ./jdk-23+25/bin/java -Xlog:os+container=trace --version [0.000s][trace][os,container] OSContainer::init: Initializing Container Support [0.000s][debug][os,container] Detected optional pids controller entry in /proc/cgroups [0.001s][debug][os,container] Detected cgroups v2 unified hierarchy [0.001s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cpu.max [0.001s][debug][os,container] Open of file /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cpu.max failed, No such file or directory [0.001s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cpu.max [0.001s][debug][os,container] Open of file /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cpu.max failed, No such file or directory [0.001s][trace][os,container] CPU Period failed: -2 [0.001s][trace][os,container] OSContainer::active_processor_count: 4 [0.001s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 4 [0.001s][trace][os,container] total physical memory: 4096421888 [0.001s][trace][os,container] Path to /memory.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/memory.max [0.001s][trace][os,container] Memory Limit is: -1 [0.001s][debug][os,container] container memory limit unlimited: -1, using host value 4096421888 [0.002s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 4 [0,023s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cpu.max [0,023s][debug][os,container] Open of file /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cpu.max failed, No such file or directory [0,023s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cpu.max [0,023s][debug][os,container] Open of file /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cpu.max failed, No such file or directory [0,023s][trace][os,container] CPU Period failed: -2 [0,023s][trace][os,container] OSContainer::active_processor_count: 4 [0,028s][trace][os,container] total physical memory: 4096421888 [0,028s][trace][os,container] Path to /memory.max is /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/memory.max [0,028s][trace][os,container] Memory Limit is: -1 [0,028s][debug][os,container] container memory limit unlimited: -1, using host value 4096421888 -------------------------- "CPU Quota is:" lines missing, but lines mentioning "cpu.max failed, No such file or directory" present.
12-06-2024

Thinking some more about this, it's probably not worth fixing. The test will change with JDK-8261242 (basically removes all this matching) and on an unconfigured cgroups v2 system it really doesn't make sense to assert what the test is currently asserting. That only leaves the missing log line. Not sure it that's important to have.
12-06-2024

The new code introduced with JDK-8302744 no longer produces a log line when it fails: int CgroupV2Subsystem::cpu_quota() { jlong quota_val; bool is_ok = _unified->read_numerical_tuple_value("/cpu.max", true /* use_first */, &quota_val); if (!is_ok) { return OSCONTAINER_ERROR; // <--- returning here } int limit = (int)quota_val; log_trace(os, container)("CPU Quota is: %d", limit); return limit; }
12-06-2024

This failure seems specific to hosts which don't have the cpu controller configured on cgroups v2. Therefore, cpu.max, interface files are not there and OSCONTAINER_ERROR (-2) is returned. cgroups v2 needs specific opt-in for the cpu controller and prior to JDK-8302744 this was accounted for with also matching '-2' as a valid value. JDK-8302744 changed log-lines from "CPU Quota is" to "CPU Quota failed" when -2 is returned causing the test failure.
11-06-2024