Skip to content

macOS: Sunshine crashes when a client starts a stream if system tray is enabled #5319

Description

@cjscld

Is there an existing issue for this?

  • I have searched the existing issues

Is your issue described in the documentation?

  • 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

  1. Install and run Sunshine 2026.619.155209 on macOS.
  2. Leave the default system_tray = enabled setting.
  3. Pair/connect from a Moonlight client.
  4. 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::start calls system_tray::update_tray_playing(...) when the first session starts.
  • system_tray::update_tray_playing calls tray_update(&tray) directly.
  • The crash report shows this happens on the rtsp::handler thread.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions