[Bug 2117446] [NEW] 6.14.0 (24.04 HWE) breaks Java heap ergonomics in container

Launchpad Bug Tracker 2117446 at bugs.launchpad.net
Thu Jul 24 17:17:31 UTC 2025


You have been subscribed to a public bug:

Given this `Vagrantfile`

```
Vagrant.configure("2") do |config|
  config.vm.box = "boxen/ubuntu-24.04"
  config.vm.box_version = "2025.04.02.21"
  config.vm.provider "virtualbox" do |vb|
     vb.memory = "4096"
  end
end
```

run `vagrant up` and when ready, `vagrant ssh`. Now install Docker as
per https://docs.docker.com/engine/install/ubuntu/ and also `sudo
usermod -aG docker $USER` and `sudo apt dist-upgrade` and then log out,
`vagrant halt`, `vagrant up`, `vagrant ssh` again to log back in with
the freshest 6.8.0 (general) kernel and running in the `docker` group.
Run

```
docker run -m 1GB eclipse-temurin java -XshowSettings:vm -XX:MaxRAMPercentage=50 -version
```

You should see something like

```
    Max. Heap Size (Estimated): 494.94M
```

i.e., ½ of 1Gb ~ 500m, as expected.

Now

```
sudo apt-get install --install-recommends linux-generic-hwe-24.04
```

and reboot, so as to be running 6.14.0. Run the Docker/Java command
again and you will get

```
    Max. Heap Size (Estimated): 1.90G
```

which is incorrect: the heap size is being taken from the physical RAM
of the VM, not the resources allocated to the container.

----

Originally observed in my 24.04.2 desktop machine, when running
https://github.com/kubernetes-sigs/kind and specifying pods with
specific memory limits which run Java without an explicit heap size (a
common setup which ensures the JVM will take good advantage of whatever
container limits you offer it). Until a few days ago, this worked fine;
on 2025-07-18 I apparently accepted a kernel upgrade to 6.14.0 from
6.8.0, and now these pods frequently crash with `OOMKilled` status
unless I manually set an explicit heap size smaller than the container
limit, such as with `-Xmx2g`. Can be seen using Kind (0.29.0) though the
setup is more complex than with Docker:

```
kubectl run --restart=Never --rm -ti --image eclipse-temurin --overrides='[{"op":"replace", "path":"/spec/containers/0/resources/limits", "value":{"memory": "2048Mi"}}]' --override-type=json java$RANDOM -- java -XshowSettings:vm -version | fgrep -i heap
```

now prints

```
Max. Heap Size (Estimated): 15.62G
```

which seems to be taking ¼ of my 64Gb physical RAM, whereas running the
same command against GKE (1.32) in the cloud

```
Max. Heap Size (Estimated): 512.00M
```

as expected.

** Affects: openjdk-21 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: kernel-daily-bug
-- 
6.14.0 (24.04 HWE) breaks Java heap ergonomics in container
https://bugs.launchpad.net/bugs/2117446
You received this bug notification because you are a member of Ubuntu Foundations Bugs, which is subscribed to openjdk-21 in Ubuntu.



More information about the foundations-bugs mailing list