RFR: 8372615: Many container tests fail when running rootless on cgroup v1

Casper Norrbin cnorrbin at openjdk.org
Fri Nov 28 15:11:00 UTC 2025


Hi everyone,

Many container tests verify that various resource limits work as expected. However, when running containers in rootless mode on both Docker and Podman with cgroup v1, resource limits are not supported. This causes tests to fail with error messages like: `Resource limits are not supported and ignored on cgroups V1 rootless systems`.

To address this, we should skip these tests when running on configurations that don't support resource limits, similar to how we already handle other unsupported configurations (e.g., missing container engine or incompatibility with a specific cgroup version or container runtime).

To check for this, we now need to use `Metrics.systemMetrics().getProvider()` from `jdk.internal.platform.Metrics` to detect cgroup v1. I've added this functionality to `DockerTestUtils`, which is already used by all container tests. As a result, all container tests now need to include the `java.base/jdk.internal.platform` module, even if they don't directly test resource limits.

Testing:
* Oracle tiers 1-5
* Local testing:
  - `hotspot/jtreg/containers/` 
  - `jdk/jdk/internal/platform/docker/`
on cgroup v1/v2 with Podman and Docker in both rootful and rootless configurations

-------------

Commit messages:
 - resource limit availability checks on container tests

Changes: https://git.openjdk.org/jdk/pull/28557/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28557&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8372615
  Stats: 63 lines in 21 files changed: 32 ins; 5 del; 26 mod
  Patch: https://git.openjdk.org/jdk/pull/28557.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28557/head:pull/28557

PR: https://git.openjdk.org/jdk/pull/28557


More information about the hotspot-dev mailing list