[RFC] Backport cgroups v2 support to 11u?

Severin Gehwolf sgehwolf at redhat.com
Fri Feb 25 10:14:36 UTC 2022


Hi,

We, Red Hat, think that getting cgroups v2 support backported to JDK
11u (and perhaps 8u) would be good at this point since systems which
use cgroups v2 by default become more an more widely used. For example
Red Hat Enterprise Linux 9[1] will have that turned on by default.
Recent Fedora and Ubuntu distributions have it on by default.
Similarly, container technology such as Docker and Kubernetes support
cgroups v2 as well.

The risk of NOT backporting those patches is that the JVM would wrongly
detect resource limits. Even though, -XX:+UseContainerSupport is on by
default in 11u, container detection code would just give up early and
would use the host systems' resource limits instead. That gets us back
to pre-JDK-8146115[2] behaviour of the JDK when running on such
systems. I.e. random OOM kills and other strange behaviour. IMHO, that
would be bad.

Cgroups v2 support has been available in the JDK since version 15 and
up and, I believe, most bugs have been shaken out in due course.
Support code has been pretty stable over the last couple of major JDK
releases. The code is Linux-only and is pretty self-contained. It is
our belief that the risks of introducing those patches to 11u is
manageable.

We propose to backport the following patch-set from JDK 15+:

Cgroups v2: Container awareness
https://bugs.openjdk.java.net/browse/JDK-8230305

Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
https://bugs.openjdk.java.net/browse/JDK-8231111

8230305 causes slowdebug build failure
https://bugs.openjdk.java.net/browse/JDK-8237479

[cgroups v2] Soft memory limit incorrectly using memory.high
https://bugs.openjdk.java.net/browse/JDK-8253714

Cgroups: Incorrect detection logic on old systems in hotspot
https://bugs.openjdk.java.net/browse/JDK-8239785

Cgroups: Incorrect detection logic on some systems
https://bugs.openjdk.java.net/browse/JDK-8239559

jtreg test error in test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
https://bugs.openjdk.java.net/browse/JDK-8244500

containers/cgroup/PlainRead.java fails on Ubuntu 21.10
https://bugs.openjdk.java.net/browse/JDK-8278951

[cgroups v2] Account for the fact that swap accounting is disabled on some systems
https://bugs.openjdk.java.net/browse/JDK-8253797

Cgroups: Incorrect detection logic on some systems (still reproducible)
https://bugs.openjdk.java.net/browse/JDK-8245543

[Metrics] Enhance parsing of cgroup interface files for version detection
https://bugs.openjdk.java.net/browse/JDK-8254001

HotSpot Not Identifying it is Running in a Container
https://bugs.openjdk.java.net/browse/JDK-8252359

Cgroup: 'stomping of _mount_path' crash if manually mounted cpusets exist
https://bugs.openjdk.java.net/browse/JDK-8253435

[TESTBUG] Increase coverage of the cgroups detection code
https://bugs.openjdk.java.net/browse/JDK-8253939

Thoughts? What do other 11u maintainers think?

Thanks,
Severin

[1] https://www.redhat.com/en/blog/whats-new-rhel-90-beta
[2] https://bugs.openjdk.java.net/browse/JDK-8146115



More information about the jdk-updates-dev mailing list