Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8346874

Linux kernel version 6.12 and newer breaks JVM container support

XMLWordPrintable

    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      Fedora 41 with kernel 6.12+

      A DESCRIPTION OF THE PROBLEM :
      A change to the cgroups mechanism in kernel 6.12 breaks the support for adjusting JVM max heap size based on container resource limits. When running

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

      the JVM expected to set a max heap of 1GB, and does so with kernel versions prior to 6.12, but with 6.12 and 6.13, the max heap is set to half of the host system main memory.
      JDK 25 EA also reports "Operating System Metrics: Provider: cgroupv2, System not containerized"

      The issue seems to be caused by https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=78567e2bc723b444228644d2e34ae5255d4ab8a0 which has the effect that /proc/cgroups no longer contains "cpuset" - resulting in this log entry: "One or more required controllers disabled at kernel level".

      It is possible to work around this problem by changing kernel build configuration: https://bugzilla.redhat.com/show_bug.cgi?id=2334161

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Boot a linux system with kernel 6.12 - eg a fully updated Fedora 41
      2) run
          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 VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Max heap 1GB
      ACTUAL -
      Max heap is set to half of host memory

      FREQUENCY : always


            sgehwolf Severin Gehwolf
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: