Public bug reported:

When the outputs are powered off (screen locked, displays asleep), each
monitor reconfiguration triggered by a hotplug event makes gnome-shell
allocate new GPU buffers, roughly 50–90 MB each time with two 1080p
monitors. The buffers from the previous configuration are not released.
They are only freed once the outputs are powered on again.

While the screens stay off, a sustained run of hotplug events (for
example a marginal HDMI connection flapping its HPD line) therefore
grows gnome-shell's GPU memory without limit. On this machine the result
was about 13 GB of shmem-backed i915 GEM memory, exhausted swap, the
kernel OOM killer, and loss of the user session. This has happened
several times.

With the outputs **on**, the same rate of reconfigurations does **not**
accumulate memory.

Environment:

- Ubuntu 24.04.5 LTS, Wayland session
- gnome-shell 46.0-0ubuntu6~24.04.17
- mutter (libmutter-14-0) 46.2-1ubuntu0.24.04.18
- Mesa 25.2.8-0ubuntu0.24.04.4 (iris)
- Xwayland 2:23.2.6-1ubuntu0.8
- Kernel 7.0.0-43-generic (also seen on 7.0.0-38-generic)
- Intel Core i5-14400, Alder Lake-S GT1 UHD Graphics 730 [8086:4682], i915 
driver, 16 GB RAM, 4 GB swap
- Two Acer G246HL monitors at 1920×1080, each connected via a DP++ (passive 
DisplayPort-to-HDMI) cable; the connectors appear as HDMI-A-1 and HDMI-A-2
- Enabled extensions (Ubuntu defaults): ding, tiling-assistant, 
ubuntu-appindicators, ubuntu-dock

Steps to reproduce (no faulty hardware needed):

A hotplug can be forced in software through sysfs. The attached
reproduce.sh script (run as root) does this. Run it, lock the screen and
allow the display(s) to sleep within the first minute. Gnome-shell's GPU
memory can then be monitored through DRM fdinfo:

for f in /proc/$(pgrep -u "$USER" -x gnome-shell)/fdinfo/*; do
  grep -h '^drm-total-system0' "$f" 2>/dev/null; done | head -1

Expected behaviour:

GPU memory stays roughly constant across reconfigurations, as it does
when the outputs are on.

Actual behaviour:

Using the reproducer script, and logging data every 10s using the
attached `display-leak-logger`, produced the attached `display-leak-log-
excerpt.tsv`. "Reconfigs" counts gnome-shell's `Failed to connect to
colord device` messages, which it logs on every monitor reconfiguration.
The log shows gnome-shell's drm-total-system0 growing as the hotplug
cycling continues, but only with the displays off. System Shmem followed
the same curve, but Xwayland's GPU memory did not change.

A run with real hardware (a flapping DP++ cable while the screen was
locked) showed the same pattern, memory usage growing from 422 to 775 MB
over 8 reconfigurations, then back to 449 MB within about 30 s of
unlocking.

The buffer size fits a new set of triple-buffered 1920×1080 XRGB8888
buffers for both outputs on each reconfiguration (2 × 3 × 8.3 MB ≈ 50
MB), with the previous set kept alive while the outputs are off.

Real-world impact:

On 2026-11-07 a marginal HDMI connection flapped for about 70 minutes
while the I was away and the screen was locked. Over that time:

- gnome-shell logged about 267 reconfiguration messages.
- Page cache, which includes shmem, grew from 7.5 GB to 12.4 GB (sar). The OOM 
reports show shmem:13103076kB in a gnome-shell page fault.
- Swap ran out (148 kB free of 4 GB).
- The OOM killer killed a Firefox content process, then gnome-software, then 
nautilus. Nautilus was running inside the user dbus service, so systemd stopped 
the whole unit, the session bus went away and the GNOME session ended.
- When the session died, cached memory dropped from 12.1 GB to 0.57 GB. This 
confirms the memory belonged to processes in the session, not to the kernel.

Notes:

- The memory isn't leaked permanently; it is released when the outputs come 
back on.
- The hotplug storms that trigger this in practice come from flaky DP++ 
adapters, which can also flap HPD when the monitors go into standby. The 
hardware is at fault there, but a display-off hotplug storm still shouldn't be 
able to take gnome-shell's memory use to the point of OOM.
- Attachments: reproduce.sh, display-leak-logger (sampling script), 
display-leak-log-excerpt.tsv.

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: gnome-shell 46.0-0ubuntu6~24.04.17
ProcVersionSignature: Ubuntu 7.0.0-43.43~24.04.1-generic 7.0.14
Uname: Linux 7.0.0-43-generic x86_64
ApportVersion: 2.28.3-0ubuntu0.1
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Sun Nov 15 11:14:05 2026
DisplayManager: gdm3
InstallationDate: Installed on 2024-10-15 (761 days ago)
InstallationMedia: Ubuntu 24.04.1 LTS "Noble Numbat" - Release amd64 
(20240827.1)
RelatedPackageVersions: mutter-common 46.2-1ubuntu0.24.04.18
SourcePackage: gnome-shell
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: gnome-shell (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug noble wayland-session

** Attachment added: "Script to reproduce the memory leak without hardware 
failure"
   
https://bugs.launchpad.net/bugs/2174516/+attachment/6018232/+files/reproduce.sh

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gnome-shell in Ubuntu.
https://bugs.launchpad.net/bugs/2174516

Title:
  GPU memory grows without bound on hotplug reconfigurations while
  outputs are powered off (leads to OOM and session loss)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/2174516/+subscriptions


-- 
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to