JDK-8335882 : platform/cgroup/TestSystemSettings.java fails on Alpine Linux
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux_alpine
  • CPU: generic
  • Submitted: 2024-07-08
  • Updated: 2024-07-15
  • Resolved: 2024-07-09
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 24
24 b06Fixed
Related Reports
Relates :  
Description
Since JDK-8261242 a new test got introduced:

test/jdk/jdk/internal/platform/cgroup/TestSystemSettings.java

This test fails on a bare Alpine Linux installation with:

 stdout: [];
 stderr: [Operating System Metrics:
    No metrics available for this platform
openjdk version "24-internal" 2024-07-05
OpenJDK Runtime Environment (fastdebug build 24-internal-adhoc.jenkinsi.jdk)
OpenJDK 64-Bit Server VM (fastdebug build 24-internal-adhoc.jenkinsi.jdk, mixed mode, sharing)
]
 exitValue = 0

java.lang.RuntimeException: 'System not containerized.' missing from stdout/stderr
at jdk.test.lib.process.OutputAnalyzer.shouldContain(OutputAnalyzer.java:252)
at TestSystemSettings.main(TestSystemSettings.java:43)
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) 
Comments
Changeset: f3ff4f74 Author: Severin Gehwolf <sgehwolf@openjdk.org> Date: 2024-07-09 10:21:47 +0000 URL: https://git.openjdk.org/jdk/commit/f3ff4f7427c3c3f5cb2a115a61462bb9d28de1cd
09-07-2024

Other relevant info on Alpine that I've used to reproduce: $ cat /etc/os-release NAME="Alpine Linux" ID=alpine VERSION_ID=3.20.1 PRETTY_NAME="Alpine Linux v3.20" HOME_URL="https://alpinelinux.org/" BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues" $ cat /proc/cgroups #subsys_name hierarchy num_cgroups enabled cpuset 0 1 1 cpu 0 1 1 cpuacct 0 1 1 blkio 0 1 1 memory 0 1 1 devices 0 1 1 freezer 0 1 1 net_cls 0 1 1 perf_event 0 1 1 net_prio 0 1 1 hugetlb 0 1 1 pids 0 1 1 $ cat /proc/self/cgroup <nothing>
08-07-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/20076 Date: 2024-07-08 14:19:21 +0000
08-07-2024

Running Alpine in a container on another Linux host system container detection seems to be working fine. $ podman run --privileged --rm -ti -v $(pwd)/jdk-24+5-alpine:/opt/jdk:z alpine /opt/jdk/bin/java -Xlog:os+container=trace -XshowSettings:system --version [0.001s][trace][os,container] OSContainer::init: Initializing Container Support [0.001s][debug][os,container] Detected optional pids controller entry in /proc/cgroups [0.002s][debug][os,container] Detected cgroups hybrid or legacy hierarchy, using cgroups v1 controllers [0.002s][trace][os,container] Path to /memory.use_hierarchy is /sys/fs/cgroup/memory/memory.use_hierarchy [0.002s][trace][os,container] Use Hierarchy is: 1 [0.002s][trace][os,container] total physical memory: 67164053504 [0.002s][trace][os,container] Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes [0.003s][trace][os,container] Memory Limit is: 9223372036854771712 [0.003s][trace][os,container] Non-Hierarchical Memory Limit is: Unlimited [0.003s][trace][os,container] Path to /memory.stat is /sys/fs/cgroup/memory/memory.stat [0.003s][trace][os,container] Hierarchical Memory Limit is: 9223372036854771712 [0.003s][trace][os,container] Hierarchical Memory Limit is: Unlimited [0.003s][debug][os,container] container memory limit ignored: 9223372036854771712, using host value 67164053504 [0.003s][trace][os,container] Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us [0.003s][trace][os,container] CPU Quota is: -1 [0.003s][trace][os,container] Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us [0.003s][trace][os,container] CPU Period is: 100000 [0.003s][trace][os,container] OSContainer::active_processor_count: 12 [0.003s][debug][os,container] OSContainer::init: is_containerized() = false because no cpu or memory limit is present Operating System Metrics: Provider: cgroupv1 System not containerized. openjdk 24-beta 2025-03-18 OpenJDK Runtime Environment Temurin-24+5-202407041902 (build 24-beta+5-ea) OpenJDK 64-Bit Server VM Temurin-24+5-202407041902 (build 24-beta+5-ea, mixed mode, sharing)
08-07-2024

On an Alpine Linux installation with -Xlog:os+container=trace we see this: $ ./jdk-24+5/bin/java -Xlog:os+container=trace --version [0.002s][trace][os,container] OSContainer::init: Initializing Container Support [0.002s][debug][os,container] Detected optional pids controller entry in /proc/cgroups [0.002s][trace][os,container] No relevant cgroup controllers mounted. openjdk 24-beta 2025-03-18 OpenJDK Runtime Environment Temurin-24+5-202407041902 (build 24-beta+5-ea) OpenJDK 64-Bit Server VM Temurin-24+5-202407041902 (build 24-beta+5-ea, mixed mode, sharing) And indeed, no cgroup info is mounted at all: $ grep cgroup /proc/self/mountinfo <nothing> Since the -XshowSettings:system switch takes the isContainerized() setting from the JVM, we need to disable the test on Alpine as it requires special setup there. I've not seen any other Linux systems without any cgroup mounts.
08-07-2024