https://bugs.kde.org/show_bug.cgi?id=524557
Bug ID: 524557
Summary: plasma-foreground-booster leaks D-Bus connections,
eventually causing plasmashell / xdg-desktop-portal to
be disconnected by dbus-broker (looks like a
"plasmashell crash" every ~3 hours)
Classification: Plasma
Product: plasmashell
Version First 6.7.4
Reported In:
Platform: CachyOS
OS: Linux
Status: REPORTED
Severity: crash
Priority: NOR
Component: "Manage Desktop and Panels" window
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: 1.0
## Environment
- Distro: CachyOS Linux (rolling)
- Kernel: 7.2.0-1-cachyos
- Plasma: plasmashell 6.7.4
- Session type: Wayland
- Package: `plasma-foreground-booster` 0.0.dmemcg.experimental-3
- D-Bus implementation: dbus-broker
- Upstream source: https://invent.kde.org/libraries/kcgroups.git
- CPU: AMD Ryzen 7 7800X3D (8 cores / 16 threads)
- GPU: AMD Radeon RX 7900 XT/XTX/GRE (Navi 31, discrete), AMD Raphael (Ryzen
7000-series iGPU)
- RAM: 64 GB (nominal), no swap configured
- sched_ext (scx): disabled at time of testing
## Symptom
Plasmashell appears to "crash" and restart roughly every **~3 hours** of
uptime, regardless of the login session. `systemctl --user status
plasma-plasmashell.service` shows a clean exit each time:
```
Process: 2283 ExecStart=/usr/bin/plasmashell --no-respawn (code=exited,
status=0/SUCCESS)
Main PID: 2283 (code=exited, status=0/SUCCESS)
Duration: 2h 59min 19.417s
```
`coredumpctl list plasmashell` returns **no coredumps** — this is not an actual
segfault/crash.
## Root cause
`dbus-broker` enforces a per-user resource quota. Immediately before every
restart, the journal shows:
```
dbus-broker: UID 1000 exceeded its 'bytes' quota on UID 1000.
dbus-broker: Peer :1.85324 is being disconnected as it does not have the
resources to receive a reply or unicast signal it expects.
dbus-broker: Peer :1.47 is being disconnected as it does not have the resources
to receive a signal it subscribed to.
...
```
dbus-broker forcibly disconnects bus peers when the quota is hit — including
**plasmashell** and **xdg-desktop-portal** / **xdg-document-portal**, all of
which fail/exit at the exact same timestamp:
```
systemd[1526]: xdg-document-portal.service: Main process exited, code=exited,
status=20/n/a
systemd[1526]: plasma-plasmashell.service: Consumed 27.080s CPU time over 2h
59min 19.636s wall clock time, 467.6M memory peak.
```
They are then relaunched automatically (plasmashell via ksmserver/session
restore), which is what the user perceives as a "crash."
### What is consuming the quota
Live capture with `dbus-monitor --session` during a live session identified the
source: **`foreground_booster`** (the `plasma-foreground-booster.service`
binary, used to detect the currently focused/foreground window so it can raise
its cgroup CPU weight) polls the active window several times per second. Each
poll opens **two brand-new D-Bus connections** rather than reusing one
persistent connection:
```
method call sender=:1.90097 -> org.freedesktop.DBus.Hello
method call sender=:1.90098 -> org.freedesktop.DBus.Hello
method call sender=:1.90098 -> org.kde.KWin /Scripting Scripting.loadScript
method call sender=:1.90098 -> org.kde.KWin /Scripting/Script0 Script.run
method call sender=:1.9 -> :1.90097 (result)
method call sender=:1.90098 -> org.kde.KWin /Scripting/Script0 Script.stop
method call sender=:1.90098 -> org.kde.KWin /Scripting Scripting.unloadScript
[both connections close, cycle repeats ~4x/second]
```
Instead of querying the active window through a stable, persistent D-Bus
interface (or the `org_kde_plasma_window_management` Wayland protocol already
referenced in the package's own `.desktop` file via
`X-KDE-Wayland-Interfaces`), it injects and tears down an ephemeral KWin
scripting-console script on a fresh connection every poll cycle.
### Measured impact
- Polling rate observed: ~4 cycles/second × 2 new connections per cycle ≈ **8
new D-Bus connections/second**, sustained continuously for the lifetime of the
login session.
- Over ~3 hours (10,800s) that is ≈ **86,000 connections**, closely matching
the connection IDs actually observed in the journal, which reached into the
`:1.85000`–`:1.90000` range within a single ~3-hour session before the quota
tripped.
- This eventually exhausts dbus-broker's per-UID quota, which then disconnects
unrelated long-lived bus clients (plasmashell, xdg-desktop-portal) as
collateral damage.
## Confirmation / workaround
Disabling the CPU-weight booster stops the leak and has no effect on the
separate `dmemcg-booster-user.service` (VRAM/dmem cgroup limits), which is a
distinct, independently-enabled systemd unit from the same package:
```
kwriteconfig6 --file kcgroupsrc --group "Foreground Booster" --key autostart
false
systemctl --user stop plasma-foreground-booster.service
```
After disabling, `busctl --user list | wc -l` / connection IDs stop climbing,
and plasmashell should remain stable indefinitely.
## Steps to reproduce
1. Ensure Foreground Booster is enabled (System Settings, or `kwriteconfig6
--file kcgroupsrc --group "Foreground Booster" --key autostart true`), then log
in to a Plasma (Wayland) session.
2. Watch connection churn live: `dbus-monitor --session
"type='method_call',destination='org.freedesktop.DBus'"` — observe a new
`Hello` + KWin `loadScript`/`run`/`stop`/`unloadScript` cycle several times per
second.
3. Optionally track the growth rate: sample `busctl --user list | wc -l` and
note the highest `:1.N` peer ID growing continuously (not just when switching
windows).
4. Leave the session running for ~3 hours under normal use. Watch `journalctl
--user -f` for:
```
dbus-broker: UID <uid> exceeded its 'bytes' quota on UID <uid>.
```
followed by plasmashell / xdg-desktop-portal exiting and restarting.
--
You are receiving this mail because:
You are watching all bug changes.