Bug 2334161 - Kernel 6.12 breaks Java container support - cgroups based resource limits
Summary: Kernel 6.12 breaks Java container support - cgroups based resource limits
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 41
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-12-26 08:31 UTC by Mathias Nicolajsen Kjærgaard
Modified: 2025-04-18 07:21 UTC (History)
16 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-04-18 07:21:10 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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"


Note You need to log in before you can comment on or make changes to this bug.