Bug 2334161

Summary: Kernel 6.12 breaks Java container support - cgroups based resource limits
Product: [Fedora] Fedora Reporter: Mathias Nicolajsen Kjærgaard <mnk>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 41CC: acaringi, adscvr, airlied, alciregi, bskeggs, fabrice, hdegoede, hpa, josef, kernel-maint, linville, masami256, mchehab, ptalbert, steved, suraj.ghimire7
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-04-18 07:21:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mathias Nicolajsen Kjærgaard 2024-12-26 08:31:27 UTC
1. Please describe the problem:
After upgrading to kernel 6.12, the container support built into Java no longer picks up the correct memory limit - as set by the container runtime.

The problem can be observed by running this command:

    podman run -it -m 2g fedora:41 bash -c "dnf install -y java-headless && java -XX:MaxRAMPercentage=50 -XshowSettings -Xlog:os+container=debug --version"

that was supposed to set the maximum heap memory to 1GB, but with kernel 6.12, sets it to 1/2 the size of the host system.

The problem seems to be related to this change: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=78567e2bc723b444228644d2e34ae5255d4ab8a0, and building the 2.16 kernel with CONFIG_CPUSETS_V1=y also solves the problem.

I would suggest building Fedora kernel with CONFIG_CPUSETS_V1=y until commonly used JDK versions have fixed compatibility with the new cgroups behaviour.


2. What is the Version-Release number of the kernel:
kernel-6.12.6-200.fc41.x86_64


3. Did it work previously in Fedora? If so, what kernel version did the issue
   *first* appear?  Old kernels are available for download at
   https://koji.fedoraproject.org/koji/packageinfo?packageID=8 :
It worked with all versions prior to 6.12

4. Can you reproduce this issue? If so, please provide the steps to reproduce
   the issue below:

   podman run -it -m 2g fedora:41 bash -c "dnf install -y java-headless && java -XX:MaxRAMPercentage=50 -XshowSettings -Xlog:os+container=debug --version"

Expected output: "Max. Heap Size (Estimated): 1.00G" - also on host systems with more than 2GB memory.

5. Does this problem occur with the latest Rawhide kernel? To install the
   Rawhide kernel, run ``sudo dnf install fedora-repos-rawhide`` followed by
   ``sudo dnf update --enablerepo=rawhide kernel``:

Yes, same problem with 6.13.0-0.rc4.36.fc42.x86_64

6. Are you running any modules that not shipped with directly Fedora's kernel?:

No

7. Please attach the kernel logs. You can get the complete kernel log
   for a boot with ``journalctl --no-hostname -k > dmesg.txt``. If the
   issue occurred on a previous boot, use the journalctl ``-b`` flag.

Reproducible: Always

Comment 1 Mathias Nicolajsen Kjærgaard 2025-04-18 07:21:10 UTC
This issue seems to have been resolved with the latest version of openjdk: https://bugs.openjdk.org/browse/JDK-8346874

Can be verified by running

podman run -it --rm --memory 4G fedora:42 bash -c "dnf install -y adoptium-temurin-java-repository && dnf --enable-repo adoptium-temurin-java-repository install -y temurin-21-jdk && java -XX:MaxRAMPercentage=25 -XX:+UseContainerSupport  -XshowSettings:vm -version"