[Linux] SIGSEGV inside exit() during service shutdown, IP == fault address (Hyprland/NVIDIA)
Is there an existing issue for this?
- [x] I have searched the existing issues (closest match: #5378, "SIGSEGV on client disconnect" — same fault signature class, different code path and already fixed for that path)
Is your issue described in the documentation?
- [x] I have read the documentation
Is your issue present in the latest beta/pre-release?
Unknown / not tested. Installed release is the "Latest" stable tag v2026.516.143833 (2026-05-16, Arch package build date 2026-08-13, installed 2026-08-28). The repo's most recent pre-releases (v2026.830.223700, v2026.830.165455) are ~3.5 months newer and postdate the fix for #5378 (nightly 2026.713.170739), so this may already be resolved upstream — flagging that gap rather than assuming a fresh bug.
Describe the Bug
sunshine segfaults with SIGSEGV while the process is inside exit() (i.e. after its own main loop has already exited cleanly), not during active streaming. Fault address equals the instruction pointer and resolves to no mapped module — same signature class as #5378 ("instruction pointer equal to the faulting address", consistent with a jump through a dangling/stale function pointer), but here the crash lands in the exit-time cleanup path (__run_exit_handlers → exit()) rather than in the RTSP disconnect handler.
Timeline (systemd/journal, all times local):
20:08:44 client sends GET /unpair (Moonlight, macOS client "roth")
20:08:57.944819 systemd: Stopping Self-hosted game stream host for Moonlight...
20:08:57.944 sunshine: Info: Terminate handler called
20:08:57.946 sunshine: Info: Main loop has exited
20:08:58.084631 kernel: sunshine[108442]: segfault at 7fcfc40000c8 ip 00007fcfc40000c8 sp 00007ffcb348fcc8 error 15 likely on CPU 3 (core 3, socket 0)
No systemctl stop invocation appears in the journal around the stop request — the terminate signal's origin wasn't captured (only that libwrap-visible systemd unit transition + Sunshine's own terminate-handler log line, effectively simultaneous).
At the moment of the crash, a worker thread was blocked inside libcuda.so.1 (poll()), i.e. a CUDA/NVENC context was still live — consistent with an encoder/GPU-resource destructor running in the wrong order during shutdown.
coredumpctl info backtrace (crashing thread; full output with all 8 threads available on request):
Stack trace of thread 108442:
#0 0x00007fcfc40000c8 n/a (n/a + 0x0)
#1 0x00005605a664df84 n/a (sunshine + 0x103f84)
#2 0x00005605a6610a96 n/a (sunshine + 0xc6a96)
#3 0x00005605a660cffa n/a (sunshine + 0xc2ffa)
#4 0x00005605a6620ea6 n/a (sunshine + 0xd6ea6)
#5 0x00005605a6610a96 n/a (sunshine + 0xc6a96)
#6 0x00005605a6647735 n/a (sunshine + 0xfd735)
#7 0x00005605a6610a96 n/a (sunshine + 0xc6a96)
#8 0x00005605a66f7dbf n/a (sunshine + 0x1addbf)
#9 0x00007fd01b640fbf n/a (libc.so.6 + 0x40fbf)
#10 0x00007fd01b64109e exit (libc.so.6 + 0x4109e)
#11 0x00007fd01b627788 n/a (libc.so.6 + 0x27788)
#12 0x00007fd01b6278b9 __libc_start_main (libc.so.6 + 0x278b9)
#13 0x00005605a6603b75 n/a (sunshine + 0xb9b75)
No debug symbols were available for this build (not on debuginfod.archlinux.org — this is an Arch/Omarchy community package build, not upstream-provided debuginfo), so the sunshine + 0x... offsets are unresolved. Happy to provide the raw (root-owned) coredump if it's useful for offline symbolization against this exact build (BuildID ce1214ae1aaa2e5873a39a5359b9fdba3be96b5f).
This is not an isolated one-off on this machine: coredumpctl list sunshine shows 6 crashes across 3 days since installing the package, in at least two distinct failure modes — this exit-time SIGSEGV (twice, back-to-back with a SIGABRT at shutdown ~3 min earlier the same evening), three SIGSEGVs within a 10-minute window on the day of install, and separately a SIGABRT (SI_TKILL) during startup inside gtk_init_check → wl_display_roundtrip_queue, unrelated to this report.
No user data loss (streaming host, no persisted user documents); Restart=on-failure (5s) on the systemd unit masks the outage in most cases.
Expected Behavior
Sunshine should tear down GPU/encoder resources and any other static state during shutdown without segfaulting, regardless of whether shutdown was triggered by a config change (pairing/unpairing), signal, or normal exit.
Additional Information
No response
Host Operating System
Arch Linux (Omarchy 4.0.1), kernel 7.1.9-arch1-2
Sunshine commit/version
v2026.516.143833 (Arch package sunshine 2026.516.143833-4, build date 2026-08-13)
Capture method
wlgrab (Wayland), Hyprland 0.56.2
GPU Type
Nvidia
GPU Model
NVIDIA GeForce RTX 3060 Ti
GPU driver/mesa version
610.57.04
Config
No response
Apps.json
No response
Relevant log output
Aug 28 20:08:58.084631 NXHome kernel: sunshine[108442]: segfault at 7fcfc40000c8 ip 00007fcfc40000c8 sp 00007ffcb348fcc8 error 15 likely on CPU 3 (core 3, socket 0)
Aug 28 20:08:58.086214 NXHome systemd-coredump[334111]: Process 108442 (sunshine) of user 1000 terminated abnormally with signal 11/SEGV, processing...
Aug 28 20:08:58.974857 NXHome systemd[1642]: app-dev.lizardbyte.app.Sunshine.service: Main process exited, code=dumped, status=11/SEGV
Aug 28 20:08:58.974953 NXHome systemd[1642]: app-dev.lizardbyte.app.Sunshine.service: Failed with result 'core-dump'.
Still reproducing on a much newer build — adding an independent datapoint, plus a little extra evidence pulled from the core dump that narrows the failure mode.
Host: Omarchy 4.0.4 (Arch), kernel 7.2.5-3-omarchy, Hyprland (Wayland)
Sunshine: AUR sunshine-bin 2026.914.233613-1 (upstream commit 63d35f702ee9e362e43263742981836ec0710384, built 2026-09-14) — ~4 months newer than your v2026.516.143833 and newer than the v2026.830.* pre-releases you flagged as possibly containing the fix, so this survives well past the #5378 fix.
GPU: Intel i915 (UHD 630), VAAPI via iHD driver, KMS capture — a different GPU/backend stack than your NVIDIA/CUDA case. The exit-time destructor bug is not NVIDIA-specific.
Trigger: idle for 44 minutes (no client since ~40 min before), systemctl --user restart of the unit, then the identical sequence:
20:57:55 systemd: Stopping Self-hosted game stream host for Moonlight...
20:57:55.349 sunshine: Info: Terminate handler called
20:57:55.350 sunshine: Info: Main loop has exited
20:57:55 kernel: sunshine[210886]: segfault at 7f8710000068 ip 00007f8710000068 sp 00007ffc20e93938 error 15 likely on CPU 0
Backtrace (coredumpctl; stripped prebuilt, offsets only):
#0 0x00007f8710000068 n/a (n/a + 0x0)
#1 0x000063bca1a22704 n/a (sunshine + 0x12b704)
#2 0x000063bca19e5e86 n/a (sunshine + 0xeee86)
#3 0x000063bca19e25ca n/a (sunshine + 0xeb5ca)
#4 0x000063bca19f6bde n/a (sunshine + 0xffbde)
#5 0x000063bca19e5e86 n/a (sunshine + 0xeee86)
#6 0x000063bca1a1b2a5 n/a (sunshine + 0x1242a5)
#7 0x000063bca19e5e86 n/a (sunshine + 0xeee86)
#8 0x000063bca1ada446 n/a (sunshine + 0x1e3446)
#9 0x00007f873b040fbf n/a (libc.so.6 + 0x40fbf)
#10 0x00007f873b04109e exit (libc.so.6 + 0x4109e)
#11 0x00007f873b027788 n/a (libc.so.6 + 0x27788)
#12 0x00007f873b0278b9 __libc_start_main (libc.so.6 + 0x278b9)
#13 0x000063bca19d6585 n/a (sunshine + 0xdf585)
Same shape as yours: exit() → __run_exit_handlers (libc+0x40fbf) → exit-time static destructor chain, one frame recursing 3× (+0xeee86 here vs +0xc6a96 in your build), ending in an indirect call that jumps to garbage. Offsets differ across builds, but the structure is a match.
Extra evidence from the core (gdb; no debug symbols — the LizardByte prebuilt is stripped and not on debuginfod):
- The crashing frame's return site (
sunshine + 0x12b704) is an indirect call through a data slot:call *0x155bcf2(%rip)→ slot at binary offset+0x16873e8, containing0x7f8710000068. si_code = SEGV_ACCERR; kernel oops error code 15 (user mode, instruction fetch, protection violation). The target page is present but non-executable — this is a jump through a stale pointer into a data page, not a jump into unmapped space.- Reading that page in the core shows an anonymous heap region full of pointers (
0x7f8710026170,0x7f87100470f0, ...) — a data structure, not code. Consistent with use-after-free/destruction-order corruption among static objects while__run_exit_handlerswalks the atexit list: a destructor calls a function pointer owned by an already-destroyed (or recycled) object. - At dump time the GTK-tray/GLib, Pango, Qt6-WaylandClient, and dconf threads were all still alive and blocked (
g_cond_wait/ppoll) — shutdown was not quiescent when static destructors ran. In my case the surviving third-party threads are the tray stack rather than a CUDA worker, which fits your "regardless of backend" expectation.
Intermittency datapoint: a second systemctl --user restart five minutes later ran the identical exit path (Terminate handler called → Main loop has exited) and shut down cleanly, no core. The destructor race only loses sometimes — worth knowing if anyone tries to reproduce deterministically.
No user data loss; Restart=on-failure (5s) masked the outage, same as on your machine. Unfortunately I discarded the core after symbolization attempts (nothing to symbolize against a stripped binary), so the offsets above are the recoverable evidence. Happy to test patches or re-run with a debug build if useful.
Another datapoint on 2026.914.233613 (commit 63d35f7), different compositor from the original report:
- Pop!_OS 24.04, kernel 7.2.15, COSMIC Wayland, RTX 3080, NVIDIA 595.104.02 (open module), deb package,
capture = kms - Segfaults on stop repeatedly (first three from today's kernel log below), after
Terminate handler called/Main loop has exited, and always at the same offset into the binary:
sunshine[4544]: segfault at 77f768010 ip 00005ec9c81f7f82 ... error 4
sunshine[5277]: segfault at 7c3d5ba9bae0 ip 00005bd582e02f82 ...
sunshine[6494]: segfault at 7cd0c170fd00 ip 0000620d65ff2f82 ...
Side effect that may be worth knowing: once, the systemd Restart= that followed the crash came up with Unable to initialize capture method and Failed to gain CAP_SYS_ADMIN for every encoder (Moonlight: "503 failed to initialize video capture"). A clean systemctl --user restart a couple of minutes later was fine, so the crashing instance may still be holding the DRM/capture resources when the replacement starts.