RFR: 8293540: [Metrics] Incorrectly detected resource limits with additional cgroup fs mounts [v5]

Severin Gehwolf sgehwolf at openjdk.org
Thu Sep 29 12:11:25 UTC 2022


> Similar issue to the hotspot change discussed in https://bugs.openjdk.org/browse/JDK-8293472. The Java metrics implementation may get the resource limits wrong if there are additional cgroup fs mounts. Apparently that's more common than one might think. I've reproduced this with these existing tests on cg v2:
> 
> 
> test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
> test/jdk/jdk/internal/platform/docker/TestDockerCpuMetrics.java
> test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java 
> 
> 
> I've also added `test/jdk/jdk/internal/platform/docker/TestDockerBasic.java` and amended `test/jdk/jdk/internal/platform/cgroup/TestCgroupSubsystemFactory.java` which unconditionally fails (irrespective of cgroup version in use). The fix is fairly straight forward and is an extension which we already do for the `cpuset` controller: Allow duplicates, and if there are any prefer those mounted at `/sys/fs/cgroup`.
> 
> Testing:
> - [x] fastdebug build on cgroups v2 and cgroups v1 (before and after the product fix)
> - [x] added tests fail before, pass after the product fix.
> - [x] Some manual testing using `cgcreate` and `cgexec` on cg1 and cg2. Still pass. 
> - [x] GHA all pass.
> 
> Please review! Many thanks in advance.

Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Merge branch 'master' into JDK-8293540-metrics-cgroups-mounts
 - Add comments/@bug in tests
 - 8293540: [Metrics] Potentially incorrectly detected resource limits with additional cgroup fs mounts

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10248/files
  - new: https://git.openjdk.org/jdk/pull/10248/files/6061a475..3ecb3b9d

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10248&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10248&range=03-04

  Stats: 30991 lines in 1069 files changed: 14803 ins; 10731 del; 5457 mod
  Patch: https://git.openjdk.org/jdk/pull/10248.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10248/head:pull/10248

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


More information about the serviceability-dev mailing list