LizardByte / LizardByte/Sunshine

Sunshine session::video segfault on stream start (AMD RDNA4 / KMS capture)

Open
#5,471 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
41.3k
Forks
2.1k
Avg merge
23h 47m
Merged PRs (30d)
124

Description

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

Sunshine's video capture thread (session::video) segfaults immediately and deterministically whenever a client (Moonlight) requests a stream. The crash happens at the same instruction offset every time, on both the stable release and the latest pre-release. Pairing and the control connection work fine — the crash only occurs once actual video capture is requested — so the client sees "No video received from host" and never gets a frame.

This is 100% reproducible: every connection attempt crashes Sunshine's video thread, Sunshine's supervisor restarts the process, and the cycle repeats on the next attempt
Log Output
Kernel log (dmesg) — segfault, reproduced 3 times across both versions
session::video[527221]: segfault at 28 ip 0000560982d8377e sp 00007f4e9aff40d0 error 4 in sunshine[51d77e,560982970000+13f8000] likely on CPU 3 (core 3, socket 0)

Code: 85 d2 0f 84 3c 02 00 00 83 aa 2c 01 00 00 01 0f 88 a2 04 00 00 41 c7 84 24 34 01 00 00 01 00 00 00 e9 ce fe ff ff 49 8b 45 68 <48> 8b 40 28 49 2b 85 b0 00 00 00 49 89 85 b8 00 00 00 e9 2a fc ff

session::video[596581]: segfault at 28 ip 000055f71e35077e sp 00007f213e7f30d0 error 4 in sunshine[51d77e,55f71df3d000+13f8000] likely on CPU 7 (core 1, socket 0)

Code: 85 d2 0f 84 3c 02 00 00 83 aa 2c 01 00 00 01 0f 88 a2 04 00 00 41 c7 84 24 34 01 00 00 01 00 00 00 e9 ce fe ff ff 49 8b 45 68 <48> 8b 40 28 49 2b 85 b0 00 00 00 49 89 85 b8 00 00 00 e9 2a fc ff

session::video[603164]: segfault at 28 ip 0000559eb08e077e sp 00007f1d757f30d0 error 4 in sunshine[51d77e,559eb04cd000+13f8000] likely on CPU 4 (core 4, socket 0)

Code: 85 d2 0f 84 3c 02 00 00 83 aa 2c 01 00 00 01 0f 88 a2 04 00 00 41 c7 84 24 34 01 00 00 01 00 00 00 e9 ce fe ff ff 49 8b 45 68 <48> 8b 40 28 49 2b 85 b0 00 00 00 49 89 85 b8 00 00 00 e9 2a fc ff

session::video[636905]: segfault at 28 ip 00005563deea777e sp 00007f95273f90d0 error 4 in sunshine[51d77e,5563dea94000+13f8000] likely on CPU 0 (core 0, socket 0)

Code: 10 e9 89 fc ff ff 49 8b 00 83 38 00 0f 85 62 fd ff ff 48 8d 05 f9 70 d6 fc 48 8b 0d 24 bc dd 06 48 89 01 31 c0 b9 d3 00 00 00 <48> 89 08 e8 f2 d8 87 06 48 89 ef 48 89 d6 e8 f7 dc 87 06 48 8d 3d

Note the identical fault offset (51d77e) in every occurrence across both tested Sunshine versions, indicating a deterministic bug at a fixed code location rather than a race condition or memory corruption artifact.
sunshine.log — startup and encoder probing succeed, no crash-related entries
The log shows a completely normal startup sequence every time: CUDA unavailable (expected, no NVIDIA GPU), display detected via KMS (HDMI-A-0, connected), and all three VAAPI encoders (H.264, HEVC, AV1) successfully created during the startup probe:

[Info] Trying encoder [vaapi]

[Info] Screencasting with KMS

[Info] /dev/dri/card0 -> amdgpu

[Info] Found monitor for DRM screencasting

[Info] Found connector ID [115]

[Info] Found cursor plane [83]

[Info] Creating encoder [h264_vaapi]

[Info] vaapi vendor: Mesa Gallium driver 25.0.7-2+deb13u1 for AMD Radeon Graphics (radeonsi, gfx1200, ACO, DRM 3.64)

[Info] Streaming bitrate is 1000000

[Info] Using normal encoding mode

[Info] Using default rate control

[Info] Creating encoder [hevc_vaapi]

...

[Info] Creating encoder [av1_vaapi]

...

[Info] Found H.264 encoder: h264_vaapi [vaapi]

[Info] Found HEVC encoder: hevc_vaapi [vaapi]

[Info] Found AV1 encoder: av1_vaapi [vaapi]

[Info] Starting system tray

[Info] Configuration UI available at [https://localhost:47990]

[Info] Starting main loop

No further entries appear after "Starting main loop" once a client actually connects and requests a stream — the process crashes and is restarted before any stream-start-related log lines are written, which is consistent with the crash occurring very early in the actual capture path (as opposed to encoder initialization, which completes successfully every time during startup

Expected Behavior

Moonlight connects, stays connected, and is able to display the content of steam on a LAN connected PC.

Additional Context

Additional Context
Two other open issues report instability on this same GPU/chip (gfx1200, RX 9060 XT) on Linux, though with different symptoms:

LizardByte/Sunshine#5378 — segfault in rtsp::handler on client disconnect (same GPU, RADV GFX1200)
LizardByte/Sunshine#5020 — Vulkan encoder visual artifacts (same GPU, gfx1200)

This suggests RDNA4 (gfx1200) support in Sunshine's Linux capture/encode pipeline may have multiple distinct outstanding issues rather than a single root cause. This report's crash is specifically in the KMS/VAAPI video capture path on stream start and is fully reproducible.

Host Operating System

Docker

Operating System Version

Linux (Debian 13 "trixie") running in "steam-headless" docker

Architecture

amd64/x86_64

Package

Linux - deb

GPU Type

AMD

GPU Model

xfx 9600xt 16GB

GPU Driver/Mesa Version

Mesa Gallium driver 25.0.7-2+deb13u1 (radeonsi, gfx1200, ACO, DRM 3.64)

Capture Method

KMS (Linux)

Apps

Log output
[2026-08-03 20:41:07.572]: Info: Sunshine version: 2026.726.710 commit: 7cb92071ac4394698e92ff6d070d310db9acc32c
[2026-08-03 20:41:07.573]: Info: Package Publisher: LizardByte
[2026-08-03 20:41:07.573]: Info: Publisher Website: https://app.lizardbyte.dev
[2026-08-03 20:41:07.573]: Info: Get support: https://app.lizardbyte.dev/support
[2026-08-03 20:41:07.573]: Info: config: 'min_log_level' = info
[2026-08-03 20:41:07.573]: Info: config: 'global_prep_cmd' = [{"do":"/usr/bin/xfce4-minimise-all-windows","undo":"/usr/bin/sunshine-stop"}]
[2026-08-03 20:41:07.573]: Info: config: 'origin_pin_allowed' = lan
[2026-08-03 20:41:07.573]: Info: config: 'file_apps' = apps.json
[2026-08-03 20:41:07.573]: Info: config: 'channels' = 2
[2026-08-03 20:41:07.573]: Info: config: 'csrf_allowed_origins' = [redacted]
[2026-08-03 20:41:07.574]: Error: Couldn't load cuda: -1
[2026-08-03 20:41:07.574]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:07.575]: Error: [wayland] Environment variable WAYLAND_DISPLAY has not been defined
[2026-08-03 20:41:07.575]: Info: Detecting displays
[2026-08-03 20:41:07.598]: Info: Detected display: DisplayPort-0 (id: 0)DisplayPort-0 connected: false
[2026-08-03 20:41:07.598]: Info: Detected display: DisplayPort-1 (id: 1)DisplayPort-1 connected: false
[2026-08-03 20:41:07.599]: Info: Detected display: HDMI-A-0 (id: 2)HDMI-A-0 connected: true
[2026-08-03 20:41:07.599]: Warning: [portalgrab] Failed to connect to dbus. Cannot enumerate displays, returning empty list.
[2026-08-03 20:41:07.625]: Warning: Gamepad ds5 is disabled due to Permission denied
[2026-08-03 20:41:07.626]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2026-08-03 20:41:07.626]: Info: Trying encoder [nvenc]
[2026-08-03 20:41:07.626]: Info: Screencasting with KMS
[2026-08-03 20:41:07.626]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:07.626]: Error: Couldn't find monitor [0]
[2026-08-03 20:41:07.626]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:07.627]: Error: Couldn't find monitor [0]
[2026-08-03 20:41:07.827]: Info: Screencasting with KMS
[2026-08-03 20:41:07.827]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:07.828]: Error: Couldn't find monitor [0]
[2026-08-03 20:41:07.828]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:07.828]: Error: Couldn't find monitor [0]
[2026-08-03 20:41:08.028]: Info: Encoder [nvenc] failed
[2026-08-03 20:41:08.028]: Info: Trying encoder [vulkan]
[2026-08-03 20:41:08.029]: Info: Screencasting with KMS
[2026-08-03 20:41:08.029]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:08.029]: Info: Found monitor for DRM screencasting
[2026-08-03 20:41:08.029]: Info: Found connector ID [115]
[2026-08-03 20:41:08.029]: Info: Found cursor plane [83]
[2026-08-03 20:41:08.029]: Info: Creating encoder [h264_vulkan]
[2026-08-03 20:41:08.029]: Info: Color coding: SDR (Rec. 601)
[2026-08-03 20:41:08.030]: Info: Color depth: 8-bit
[2026-08-03 20:41:08.030]: Info: Color range: JPEG
[2026-08-03 20:41:08.075]: Info: Streaming bitrate is 1000000
[2026-08-03 20:41:08.075]: Error: [h264_vulkan @ 0x55c7372ae480] Device does not support the VK_KHR_video_encode_queue extension!
[2026-08-03 20:41:08.078]: Error: Could not open codec [h264_vulkan]: Function not implemented
[2026-08-03 20:41:08.078]: Info: Creating encoder [h264_vulkan]
[2026-08-03 20:41:08.078]: Info: Color coding: SDR (Rec. 601)
[2026-08-03 20:41:08.078]: Info: Color depth: 8-bit
[2026-08-03 20:41:08.078]: Info: Color range: JPEG
[2026-08-03 20:41:08.120]: Info: Streaming bitrate is 1000000
[2026-08-03 20:41:08.120]: Error: [h264_vulkan @ 0x55c7372ae480] Device does not support the VK_KHR_video_encode_queue extension!
[2026-08-03 20:41:08.123]: Error: Could not open codec [h264_vulkan]: Function not implemented
[2026-08-03 20:41:08.123]: Info: Encoder [vulkan] failed
[2026-08-03 20:41:08.123]: Info: Trying encoder [vaapi]
[2026-08-03 20:41:08.123]: Info: Screencasting with KMS
[2026-08-03 20:41:08.123]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:08.123]: Info: Found monitor for DRM screencasting
[2026-08-03 20:41:08.123]: Info: Found connector ID [115]
[2026-08-03 20:41:08.123]: Info: Found cursor plane [83]
[2026-08-03 20:41:08.134]: Info: Creating encoder [h264_vaapi]
[2026-08-03 20:41:08.134]: Info: Color coding: SDR (Rec. 601)
[2026-08-03 20:41:08.134]: Info: Color depth: 8-bit
[2026-08-03 20:41:08.134]: Info: Color range: JPEG
[2026-08-03 20:41:08.145]: Info: EGL: context priority set to HIGH
[2026-08-03 20:41:08.151]: Info: vaapi vendor: Mesa Gallium driver 25.0.7-2+deb13u1 for AMD Radeon Graphics (radeonsi, gfx1200, ACO, DRM 3.64, 6.18.38-Unraid)
[2026-08-03 20:41:08.151]: Info: Streaming bitrate is 1000000
[2026-08-03 20:41:08.151]: Info: Using normal encoding mode
[2026-08-03 20:41:08.151]: Info: [VAAPI] Quality level set to 0 (fastest level: 32)
[2026-08-03 20:41:08.151]: Info: [VAAPI] Using CBR rate control with standard VBV size
[2026-08-03 20:41:08.193]: Info: Creating encoder [hevc_vaapi]
[2026-08-03 20:41:08.193]: Info: Color coding: SDR (Rec. 601)
[2026-08-03 20:41:08.193]: Info: Color depth: 8-bit
[2026-08-03 20:41:08.193]: Info: Color range: JPEG
[2026-08-03 20:41:08.202]: Info: EGL: context priority set to HIGH
[2026-08-03 20:41:08.209]: Info: vaapi vendor: Mesa Gallium driver 25.0.7-2+deb13u1 for AMD Radeon Graphics (radeonsi, gfx1200, ACO, DRM 3.64, 6.18.38-Unraid)
[2026-08-03 20:41:08.209]: Info: Streaming bitrate is 1000000
[2026-08-03 20:41:08.209]: Info: Using normal encoding mode
[2026-08-03 20:41:08.209]: Info: [VAAPI] Quality level set to 0 (fastest level: 32)
[2026-08-03 20:41:08.210]: Info: [VAAPI] Using CBR rate control with standard VBV size
[2026-08-03 20:41:08.243]: Info: Creating encoder [av1_vaapi]
[2026-08-03 20:41:08.243]: Info: Color coding: SDR (Rec. 601)
[2026-08-03 20:41:08.243]: Info: Color depth: 8-bit
[2026-08-03 20:41:08.243]: Info: Color range: JPEG
[2026-08-03 20:41:08.253]: Info: EGL: context priority set to HIGH
[2026-08-03 20:41:08.257]: Info: vaapi vendor: Mesa Gallium driver 25.0.7-2+deb13u1 for AMD Radeon Graphics (radeonsi, gfx1200, ACO, DRM 3.64, 6.18.38-Unraid)
[2026-08-03 20:41:08.257]: Info: Streaming bitrate is 1000000
[2026-08-03 20:41:08.257]: Info: Using normal encoding mode
[2026-08-03 20:41:08.257]: Info: [VAAPI] Quality level set to 0 (fastest level: 32)
[2026-08-03 20:41:08.257]: Info: [VAAPI] Using VBR rate control with single frame VBV size (whitelist override)
[2026-08-03 20:41:08.258]: Warning: [av1_vaapi @ 0x55c7372ae480] Multiple slices were requested but this codec does not support controlling slices.
[2026-08-03 20:41:08.283]: Info: Screencasting with KMS
[2026-08-03 20:41:08.283]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:08.283]: Info: Found monitor for DRM screencasting
[2026-08-03 20:41:08.283]: Info: Found connector ID [115]
[2026-08-03 20:41:08.284]: Info: Found cursor plane [83]
[2026-08-03 20:41:08.290]: Info: Screencasting with KMS
[2026-08-03 20:41:08.291]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:08.291]: Info: Found monitor for DRM screencasting
[2026-08-03 20:41:08.291]: Info: Found connector ID [115]
[2026-08-03 20:41:08.291]: Info: Found cursor plane [83]
[2026-08-03 20:41:08.298]: Info: Screencasting with KMS
[2026-08-03 20:41:08.298]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:08.298]: Info: Found monitor for DRM screencasting
[2026-08-03 20:41:08.298]: Info: Found connector ID [115]
[2026-08-03 20:41:08.298]: Info: Found cursor plane [83]
[2026-08-03 20:41:08.305]: Info: Creating encoder [hevc_vaapi]
[2026-08-03 20:41:08.305]: Info: Color coding: SDR (Rec. 709)
[2026-08-03 20:41:08.305]: Info: Color depth: 10-bit
[2026-08-03 20:41:08.305]: Info: Color range: JPEG
[2026-08-03 20:41:08.314]: Info: EGL: context priority set to HIGH
[2026-08-03 20:41:08.320]: Info: vaapi vendor: Mesa Gallium driver 25.0.7-2+deb13u1 for AMD Radeon Graphics (radeonsi, gfx1200, ACO, DRM 3.64, 6.18.38-Unraid)
[2026-08-03 20:41:08.320]: Info: Streaming bitrate is 1000000
[2026-08-03 20:41:08.320]: Info: Using normal encoding mode
[2026-08-03 20:41:08.320]: Info: [VAAPI] Quality level set to 0 (fastest level: 32)
[2026-08-03 20:41:08.320]: Info: [VAAPI] Using CBR rate control with standard VBV size
[2026-08-03 20:41:08.352]: Info: Screencasting with KMS
[2026-08-03 20:41:08.352]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:08.352]: Info: Found monitor for DRM screencasting
[2026-08-03 20:41:08.352]: Info: Found connector ID [115]
[2026-08-03 20:41:08.353]: Info: Found cursor plane [83]
[2026-08-03 20:41:08.359]: Info: Screencasting with KMS
[2026-08-03 20:41:08.359]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:08.360]: Info: Found monitor for DRM screencasting
[2026-08-03 20:41:08.360]: Info: Found connector ID [115]
[2026-08-03 20:41:08.360]: Info: Found cursor plane [83]
[2026-08-03 20:41:08.367]: Info: Screencasting with KMS
[2026-08-03 20:41:08.367]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:08.368]: Info: Found monitor for DRM screencasting
[2026-08-03 20:41:08.368]: Info: Found connector ID [115]
[2026-08-03 20:41:08.368]: Info: Found cursor plane [83]
[2026-08-03 20:41:08.374]: Info: Creating encoder [av1_vaapi]
[2026-08-03 20:41:08.374]: Info: Color coding: SDR (Rec. 709)
[2026-08-03 20:41:08.374]: Info: Color depth: 10-bit
[2026-08-03 20:41:08.374]: Info: Color range: JPEG
[2026-08-03 20:41:08.383]: Info: EGL: context priority set to HIGH
[2026-08-03 20:41:08.387]: Info: vaapi vendor: Mesa Gallium driver 25.0.7-2+deb13u1 for AMD Radeon Graphics (radeonsi, gfx1200, ACO, DRM 3.64, 6.18.38-Unraid)
[2026-08-03 20:41:08.387]: Info: Streaming bitrate is 1000000
[2026-08-03 20:41:08.388]: Info: Using normal encoding mode
[2026-08-03 20:41:08.388]: Info: [VAAPI] Quality level set to 0 (fastest level: 32)
[2026-08-03 20:41:08.388]: Info: [VAAPI] Using VBR rate control with single frame VBV size (whitelist override)
[2026-08-03 20:41:08.388]: Warning: [av1_vaapi @ 0x55c7372bad40] Multiple slices were requested but this codec does not support controlling slices.
[2026-08-03 20:41:08.415]: Info: Screencasting with KMS
[2026-08-03 20:41:08.415]: Info: /dev/dri/card0 -> amdgpu
[2026-08-03 20:41:08.416]: Info: Found monitor for DRM screencasting
[2026-08-03 20:41:08.416]: Info: Found connector ID [115]
[2026-08-03 20:41:08.416]: Info: Found cursor plane [83]
[2026-08-03 20:41:08.423]: Info: 
[2026-08-03 20:41:08.423]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2026-08-03 20:41:08.423]: Info: 
[2026-08-03 20:41:08.423]: Info: Found H.264 encoder: h264_vaapi [vaapi]
[2026-08-03 20:41:08.423]: Info: Found HEVC encoder: hevc_vaapi [vaapi]
[2026-08-03 20:41:08.423]: Info: Found AV1 encoder: av1_vaapi [vaapi]
[2026-08-03 20:41:08.424]: Info: Starting system tray
[2026-08-03 20:41:08.425]: Error: Failed to create client: Daemon not running
[2026-08-03 20:41:08.429]: Info: Configuration UI available at [https://localhost:47990]
[2026-08-03 20:41:08.438]: Info: System tray created
[2026-08-03 20:41:08.439]: Info: Starting main loop
[2026-08-03 20:52:48.519]: Info: Web UI: [10.0.0.105] -- not authorized
Online logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the crash with Moonlight on the reported Debian 13 Docker environment and inspect the session::video KMS/VAAPI capture path. Use the repeated segfault offset and the startup logs to narrow the failure to stream start rather than encoder probing. Done means Sunshine no longer crashes when a client requests video and Moonlight receives frames.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, docker, linux
Domain
audio-video-rtc, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.