-
Bug
-
Resolution: Fixed
-
P3
-
15, 16
-
b19
-
generic
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8254150 | 15.0.2 | Severin Gehwolf | P3 | Resolved | Fixed | b02 |
JDK-8285293 | 11.0.16-oracle | Ioi Lam | P3 | Resolved | Fixed | b04 |
JDK-8283570 | 11.0.16 | Severin Gehwolf | P3 | Resolved | Fixed | b01 |
JDK-8298280 | openjdk8u372 | Severin Gehwolf | P3 | Resolved | Fixed | b01 |
JDK-8295367 | 8u361 | Ivan Bereziuk | P3 | Resolved | Fixed | b03 |
For example Metrics.getMemoryAndSwapLimit() has this javadoc:
"""
Returns the maximum amount of physical memory and swap space, in bytes, that can be allocated in the Isolation Group.
"""
Yet, the cgroup v2 code only reads memory.swap.max not taking memory.max into account. The results are incorrect. This was previously hiding since the initial crun code seems to have been setting memory.swap.max to the --memory-swap UI option value directly. It's now setting it to $MEMORY_SWAP-$MEMORY so as to mimic cgroups v1 behaviour.
Example:
$ podman run --rm -v $(pwd)/build/linux-x86_64-server-release/images/jdk:/jdk -ti --memory=200m --memory-swap=1g fedora:31 /bin/bash
[root@ce700ea24fd2 /]# /jdk/bin/java -XshowSettings:system -version
Operating System Metrics:
Provider: cgroupv2
Effective CPU Count: 4
CPU Period: 100000us
CPU Quota: -1
CPU Shares: -1
List of Processors: N/A
List of Effective Processors: N/A
List of Memory Nodes: N/A
List of Available Memory Nodes: N/A
Memory Limit: 200.00M
Memory Soft Limit: Unlimited
Memory & Swap Limit: 824.00M
openjdk version "16-internal" 2021-03-16
OpenJDK Runtime Environment (build 16-internal+0-adhoc.sgehwolf.jdk-jdk)
OpenJDK 64-Bit Server VM (build 16-internal+0-adhoc.sgehwolf.jdk-jdk, mixed mode, sharing)
This also yields a test failure in jdk/internal/platform/docker/TestDockerMemoryMetrics.java:
stdout: [[memoryswap, 200m, 1g]
Exception in thread "main" java.lang.RuntimeException: Memory and swap limit not equal, expected : [209715200, 1073741824], got : [209715200, 864026624]
at MetricsMemoryTester.testMemoryAndSwapLimit(MetricsMemoryTester.java:150)
at MetricsMemoryTester.main(MetricsMemoryTester.java:40)
- backported by
-
JDK-8254150 [cgroups v2] Memory and swap limits reported incorrectly
- Resolved
-
JDK-8283570 [cgroups v2] Memory and swap limits reported incorrectly
- Resolved
-
JDK-8285293 [cgroups v2] Memory and swap limits reported incorrectly
- Resolved
-
JDK-8295367 [cgroups v2] Memory and swap limits reported incorrectly
- Resolved
-
JDK-8298280 [cgroups v2] Memory and swap limits reported incorrectly
- Resolved
- relates to
-
JDK-8253714 [cgroups v2] Soft memory limit incorrectly using memory.high
- Resolved
-
JDK-8230305 Cgroups v2: Container awareness
- Resolved
- links to
-
Commit openjdk/jdk8u-dev/97d00caf
-
Commit openjdk/jdk11u-dev/3fc205cf
-
Commit openjdk/jdk/3e96721c
-
Review openjdk/jdk8u-dev/168
-
Review openjdk/jdk11u-dev/894
-
Review openjdk/jdk/384