omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Runaway memory leak in quickshell causing system-wide OOM

Open austrasien opened this issue 3 months ago • 2 comments

Description

On Omarchy v4.0.2-1, the quickshell process (PID 1459) experienced an extreme, runaway memory allocation/leak, consuming over 43.5 GB of resident memory (anon-rss) and 167 GB of virtual memory (total-vm).

This completely exhausted all physical RAM (46 GB) and system swap space (98 GB), bringing the system to a critical Out of Memory (OOM) state. As a result, other user processes—such as the Cursor IDE (Electron)—crashed via internal allocator traps (SIGTRAP) due to allocation failure, before the kernel's OOM-killer ultimately stepped in and terminated quickshell to rescue the system.

Evidence (Kernel Logs)

Sep 02 23:38:06 omarchy kernel: electron invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=200
...
Sep 02 23:38:06 omarchy kernel: [  pid  ]   uid  tgid total_vm      rss rss_anon rss_file rss_shmem pgtables_bytes swapents oom_score_adj name
...
Sep 02 23:38:06 omarchy kernel: [   1459]  1000  1459 41788245 10896991 10896987        4         0 278638592 23707501           200 quickshell
...
Sep 02 23:38:06 omarchy kernel: Out of memory: Killed process 1459 (quickshell) total-vm:167152980kB, anon-rss:43587948kB, file-rss:16kB, shmem-rss:0kB, UID:1000 pgtables:272108kB oom_score_adj:200

System Details

  • Omarchy Version: 4.0.2-1
  • Kernel: 7.1.9-arch1-2 (PREEMPT)
  • Hardware: Framework Laptop 13 (AMD Ryzen AI 300 Series) / BIOS 04.02

Filed by Gemini CLI via interactive agent.

austrasien avatar Sep 02 '26 21:09 austrasien

The OOM record is solid evidence that quickshell held 43.5 GB of anonymous memory, and nothing else — it says which process died, not which subsystem retained the memory. I read the shell tree on current quattro for a mechanism that could reach that scale and could not name one, so this is not diagnosable as filed. Being specific about that rather than asking for "more details":

Paths in the shell that can retain unbounded bytes (all speculative until data selects one):

  • Clipboard history keeps up to 500 entries in memory with no byte limit, and re-serialises the whole array on every capture (shell/plugins/clipboard/Clipboard.qml:40, :75-86). Images are stored as file paths, so this is a text-volume risk, not an image one.
  • Critical notifications never expire (#9361), and notification bodies have no size limit (shell/plugins/notifications/Service.qml:92-105).
  • A custom bar widget's exec command is read through a StdioCollector (shell/plugins/bar/Bar.qml:1825-1835): a command that never exits while writing would grow that buffer without bound.
  • The image picker keeps every image it has scrolled past decoded (shell/plugins/image-picker/ImagePicker.qml:502-512, cache: true and no sourceSize, deliberately, so textures survive selection moves), and falls back to the original file when an entry has no thumbnail (ImagePickerModel.js:29).

What would turn this into a diagnosis:

  1. ~/.config/omarchy/shell.json and omarchy plugin list --json. Third-party and cloned plugins run inside the same process, so the enabled set is the first thing that narrows this.
  2. RSS over time, so we can tell a steady climb from a step: while :; do printf '%s ' "$(date -Is)"; ps -o rss=,vsz= -C quickshell; sleep 60; done | tee /tmp/qs-rss.log, left running for a couple of hours that include the growth. On a stock 4.0.2 VM the shell sits around 850 MB, so anything climbing past a few GB is already the bug.
  3. cat /proc/$(pgrep -x quickshell)/smaps_rollup while it is large — that separates a JS/QML heap (anonymous) from GPU or driver mappings, which the 167 GB of virtual size hints at.
  4. A heap profile taken during the growth: heaptrack -p $(pgrep -x quickshell), then the resulting heaptrack.quickshell.*.zst. That is the artifact that would name the allocation site outright; a valgrind --tool=massif run works too but is much slower.
  5. journalctl --user -b -1 -t omarchy-shell covering the hours before the kill. Two known failures in this release produce heavy churn and would be visible there: the QTimer-interval flood in #9832 and the shell crash-loop in #7380. Neither is an anonymous-memory leak, but ruling them in or out costs one grep (negative intervals, exited with status 255).
  6. What the session was doing — animated or very large wallpaper, screen recording, heavy clipboard use, which panels were open — plus ls -l ~/.local/state/omarchy/clipboard-history.json.

If it recurs before any of that can be collected, the single most useful thing is item 4 taken while RSS is climbing.

Reviewed by Claude Opus 5 in Claude Code, with an independent second opinion from Codex (gpt-5.6-sol) at xhigh reasoning. Codex reached the same conclusion — several credible retention paths, none selectable from the report — and independently named the clipboard, notification and custom-bar-command paths above.

omarchybot avatar Sep 03 '26 12:09 omarchybot

Re-read against current quattro (983014283). Still no diagnosis from the OOM record alone, and no existing issue is the same bug, but one candidate has been reported since the first reply and it can be checked with a single grep.

#13072 describes the shell rebuilding its panels after an idle lock and wake without destroying the old ones, on the same 4.0.2 release. If that is what happened here, every wake cycle leaves a full copy of the panel tree behind, which would grow anonymous memory steadily over a long session. It leaves a clear signature in the journal:

journalctl --user -b -1 | grep -c 'Handler was registered but will not be used'

A count in the dozens or more, appearing in bursts around lock and wake, points at #13072 (#13165 is an open fix for its trigger). #10746 shows the same signature from plugin hot-reloads, so if you edit plugins under ~/.config/omarchy/plugins/ that is worth mentioning too. A count of zero rules both out. Separately, #14919 is an open pull request bounding clipboard history size, which covers the clipboard path named earlier; ls -l ~/.local/state/omarchy/clipboard-history.json still says whether that one is in play.

Everything else asked for in the first reply still applies, with a heap profile taken while memory is climbing remaining the most useful single thing. This waits on the reporter.

Reviewed by Claude Opus 5.5 in Claude Code, with a second opinion from Codex Medium. Codex agreed that no cause can be selected from the report and that it is not a duplicate; it also flagged that a duplicate-handler signature would support #13072 without proving it, since the warning alone does not show the old objects being kept. Its independence from this review is not guaranteed.

omarchybot avatar Oct 11 '26 02:10 omarchybot