macOS: Sunshine crashes when a client starts a stream if system tray is enabled
Is there an existing issue for this?
- [x] I have searched the existing issues
Is your issue described in the documentation?
- [x] I have read the documentation
Is your issue present in the latest beta/pre-release?
This issue is present in the latest pre-release
Describe the Bug
Summary
On macOS, Sunshine 2026.619.155209 crashes as soon as a Moonlight client starts a streaming session when the system tray is enabled.
The crash happens during the RTSP announce/start-session path while updating the tray icon/notification from the RTSP handler thread. Disabling the system tray with system_tray = disabled avoids the crash and streaming starts normally.
Reproduction steps
- Install and run Sunshine 2026.619.155209 on macOS.
- Leave the default
system_tray = enabledsetting. - Pair/connect from a Moonlight client.
- Start the Desktop app/session from the client.
Actual behavior
Sunshine sometimes crashes immediately when the client connects/starts the session. Crash reports consistently show SIGTRAP in AppKit while tray_update is called from the RTSP handler thread.
Observed crash stack excerpt:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Faulting thread: rtsp::handler
-[BSServiceMainRunLoopQueue assertBarrierOnQueue]
-[FBSScene _updateClientSettings:]
-[NSSceneStatusItem _updateSupportsExpandedInterfaceSession]
-[NSStatusItem setMenu:]
tray_update
system_tray::update_tray_playing(std::string)
stream::session::start(...)
rtsp_stream::cmd_announce(...)
rtsp_stream::socket_t::handle_read_encrypted_message(...)
Workaround
Adding the following to sunshine.conf and restarting Sunshine prevents the crash:
system_tray = disabled
After this workaround, the same client connects successfully.
Expected Behavior
Sunshine should not crash when a client starts a stream with the macOS system tray enabled. Tray icon/menu/notification updates should be marshalled to the appropriate macOS main/UI thread or otherwise performed safely.
Additional Context
This appears to be a macOS UI-thread issue rather than an encoder or network issue. The crash only occurs when the tray is enabled; after setting system_tray = disabled, streaming starts immediately.
Local source reference from the current master/pre-release code:
stream::session::startcallssystem_tray::update_tray_playing(...)when the first session starts.system_tray::update_tray_playingcallstray_update(&tray)directly.- The crash report shows this happens on the
rtsp::handlerthread.
Host Operating System
macOS
Operating System Version
macOS 27.0 (26A5368g)
Architecture
arm64/aarch64
Package
macOS - dmg
GPU Type
Apple Silicon
GPU Model
Apple M2 (10-core GPU)
GPU Driver/Mesa Version
Apple Metal / macOS 27.0 (26A5368g)
Capture Method
AVCaptureScreen (macOS)
Apps
Log output
[2026-06-23 13:10:31.779]: Info: Sunshine version: 2026.619.155209 commit: 1fce18d99a1dfc925b501a6a9b8bc280b6675fc5
[2026-06-23 13:10:32.583]: Info: Found H.264 encoder: h264_videotoolbox [videotoolbox]
[2026-06-23 13:10:32.583]: Info: Found HEVC encoder: hevc_videotoolbox [videotoolbox]
[2026-06-23 13:10:32.583]: Info: Starting system tray
[2026-06-23 13:10:32.586]: Info: Configuration UI available at [https://localhost:47990]
[2026-06-23 13:10:32.628]: Info: System tray created
[2026-06-23 13:10:33.313]: Info: Successfully registered DNS service
Crash report excerpt:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Faulting thread: rtsp::handler
-[BSServiceMainRunLoopQueue assertBarrierOnQueue]
-[NSStatusItem setMenu:]
tray_update
system_tray::update_tray_playing(std::string)
stream::session::start(...)
rtsp_stream::cmd_announce(...)
After workaround:
[2026-06-23 13:15:56.445]: Info: config: 'system_tray' = disabled
[2026-06-23 13:15:57.199]: Info: Found H.264 encoder: h264_videotoolbox [videotoolbox]
[2026-06-23 13:15:57.199]: Info: Found HEVC encoder: hevc_videotoolbox [videotoolbox]
Streaming then starts successfully from the client.
Online logs
No response
@andygrundman any ideas? Something maybe wrong with packaging the icon files in the dmg?
I also recently upgraded to macOS 27 beta, and Sunshine kept crashing every time I tried to connect. Following your suggestion to modify the config with system_tray = disabled, I can now successfully stream. Much appreciated!
I've already fixed this locally while working on Mac, I will submit a PR on the tray repo.