Skip to content

Conversation

@caspernorrbin
Copy link
Member

@caspernorrbin caspernorrbin commented Nov 28, 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

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8372615: Many container tests fail when running rootless on cgroup v1 (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28557/head:pull/28557
$ git checkout pull/28557

Update a local copy of the PR:
$ git checkout pull/28557
$ git pull https://git.openjdk.org/jdk.git pull/28557/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28557

View PR using the GUI difftool:
$ git pr show -t 28557

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28557.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 28, 2025

👋 Welcome back cnorrbin! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 28, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title 8372615 8372615: Many container tests fail when running rootless on cgroup v1 Nov 28, 2025
@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Nov 28, 2025
@openjdk
Copy link

openjdk bot commented Nov 28, 2025

@caspernorrbin The following labels will be automatically applied to this pull request:

  • core-libs
  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 28, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 28, 2025

Webrevs

Comment on lines +141 to +142
* @return true if resource limits are supported in the current configuration
* @throws Exception
Copy link
Member

@dholmes-ora dholmes-ora Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this pattern of making a function seem like it is a query by declaring it returns a boolean when in reality it either returns true or else throws. These should just be void functions with names like checkCanUseResourceLimits, and we can elide the fake if conditions with unreachable return statements in the callers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org hotspot hotspot-dev@openjdk.org rfr Pull request is ready for review serviceability serviceability-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

2 participants