Commit d8346672 by PLN (Algolia)

fix(audio): shield SuperDirt from the display stack — headless sclang (QT_QPA_PLATFORM=offscreen)

Root-caused the 2026-07-25 overnight-sleep crash where the music (and Ardour)
died on resume. It was NOT an audio-hardware failure — it was the *display stack*
taking down the sound.

Evidence (all at resume, ~11:17):
  11:17:31  kwin_wayland (pid 2603) SIGABRT — the Wayland compositor aborted on
            resume-from-suspend (deep internal assertion; core shows abort→libc).
            Plasma respawned the whole session (new kwin/plasmashell/Xwayland,
            confirmed by their ~1h40m uptime vs the machine's 1d+).
  11:17:35  ardour9: "Fatal IO error 104 (Connection reset by peer) on X server
            :1" — Ardour, an X11 client on Xwayland, died with the session.
  11:17:35→44  scsynth SIGABRT via std::terminate — ~4s after kwin, in the
            cascade: sclang is a Qt6/Wayland client, so it lost its display
            connection when kwin died and crashed, and scsynth (which it hosts)
            aborted on the broken IPC.

Why short naps survive but an overnight one didn't: a quick suspend/resume just
pauses the Wayland connection; the long/overnight cycle triggered a GPU/DRM reset
that made kwin actually crash — and a crashed compositor severs every client at
once.

Fix: sclang doesn't need a display. QT_QPA_PLATFORM=offscreen runs its Qt without
connecting to any display server, so a compositor crash/restart can no longer reach
it — the SuperDirt brain becomes immune to the entire Wayland/X lifecycle. SuperDirt
uses no GUI; the interpreter and post window still work in the terminal. Validated:
`QT_QPA_PLATFORM=offscreen sclang` compiles the class library and reaches the
SuperCollider 3.14.1 banner with zero wayland/qpa errors.

collide.sh is the only launcher (perf.sh only reprioritizes a *running* sclang, it
doesn't spawn one), so this single line closes the gap.

Not addressed here (harder, separate levers): kwin's resume-crash itself is a
Plasma/GPU-driver issue — the standing mitigation is running dGPU-off
(./gpu-mode.sh integrated), which removes the Xwayland-on-dGPU DRM reset that's the
likely abort trigger and would also spare Ardour's :1 connection.
parent 44263086
#! /usr/bin/env sh #! /usr/bin/env sh
# Boot SuperCollider's interpreter (SuperDirt host) HEADLESS.
#
# sclang is built against Qt6 and, by default, connects to the Wayland compositor
# as a GUI client. That coupling is a liability for a live set: on 2026-07-25 an
# overnight suspend made kwin_wayland crash on resume (SIGABRT), and because sclang
# was a Wayland client it lost its display connection and died — cascade-killing
# scsynth (and Ardour, an X client on :1) with it. The audio hardware was fine; the
# *display stack* took down the sound.
#
# QT_QPA_PLATFORM=offscreen makes sclang's Qt run without connecting to any display
# server, so a compositor crash/restart can no longer touch it. SuperDirt needs no
# GUI; the interpreter and post window still work normally in this terminal.
export QT_QPA_PLATFORM=offscreen
sclang sclang
./link_jack.sh ./link_jack.sh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment