JDK-8293472: Incorrect container resource limit detection if manual cgroup fs mounts present#10193
JDK-8293472: Incorrect container resource limit detection if manual cgroup fs mounts present#10193casparcwang wants to merge 13 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back casparcwang! A progress list of the required criteria for merging this PR into |
|
@casparcwang The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
jerboaa
left a comment
There was a problem hiding this comment.
Looks mostly good. https://bugs.openjdk.org/browse/JDK-8270087 seems to be an early sighting of this. It mentions a reproducer, manually mount /sys/fs/cgroup from the host into the container. Please write a container test asserting that no warnings get produced. Perhaps use test/hotspot/jtreg/containers/docker/DockerBasicTest.java and write a new test method javaVersionWithCgMounts or some such, which verifies no warning shows up on stdout.
|
My testing on cgv2 and cgv1 indicates that we might have a container resource limit detection problem depending on the order of |
Thank you very much for the reviewing. I have not noticed JDK-8270087 before, sorry about filing a duplicate jdk bug.
The |
jerboaa
left a comment
There was a problem hiding this comment.
We definitely need regression tests for memory/cpu limits with those additional cgroup mounts.
Please take a look at test/hotspot/jtreg/containers/docker/TestCPUAwareness.java and test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
For cgroups v2 the issues isn't fixed. The paths for cg v2 are being set here:
https://github.com/openjdk/jdk/blob/98da03af50e2372817a7b5e381eea5ee6f2cb919/src/hotspot/os/linux/cgroupSubsystem_linux.cpp#L303..L313.
Example of running (with your patch on a cg v2 system):
$ sudo podman run --rm -ti --memory=300M --memory-swap=300M -v /sys/fs/cgroup:/cgroup-in:ro -v $(pwd)/jdk20-jdk:/opt/jdk:z fedora:36 /opt/jdk/bin/java -Xlog:os+container=trace -version 2>&1 | grep 'Memory Limit'
[0.001s][trace][os,container] Memory Limit is: -2
[0.055s][trace][os,container] Memory Limit is: -2
Expected:
[0.001s][trace][os,container] Memory Limit is: 314572800
[0.068s][trace][os,container] Memory Limit is: 314572800
I have add a cgroup v2 test with duplicate mount info, now it's working for cgroup v2. |
jerboaa
left a comment
There was a problem hiding this comment.
Thanks for the updates! A few more thoughts.
jerboaa
left a comment
There was a problem hiding this comment.
Looks good to me. Feel free to add the suggestion.
|
|
@casparcwang This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 105 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jerboaa, @iklam) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
/integrate |
|
@casparcwang |
|
Is it OK to be pushed? Or shall we wait for one more review? |
A second review would be good. Perhaps @iklam has some cycles? |
iklam
left a comment
There was a problem hiding this comment.
Looks good to me. Just a small nit on the test,
|
@casparcwang Feel free to issue |
|
/integrate |
Thank you very much! |
|
@casparcwang |
|
/sponsor |
|
Going to push as commit 8f3bbe9.
Your commit was automatically rebased without conflicts. |
|
@jerboaa @casparcwang Pushed as commit 8f3bbe9. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Similar to JDK-8253435, when setting the mount path of cgroup controller "memory/cpu/cpuacct/pids", it should also discard duplicate items.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10193/head:pull/10193$ git checkout pull/10193Update a local copy of the PR:
$ git checkout pull/10193$ git pull https://git.openjdk.org/jdk pull/10193/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10193View PR using the GUI difftool:
$ git pr show -t 10193Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10193.diff