Periodic unprompted "Starting async encoder teardown" during active session causes brief capture/input disruption (no corresponding OS/driver event)
还没有人认领这个 Issue。
评估
调研方向
Start by reviewing the reported sequence around “Starting async encoder teardown,” display loss, and NVENC session failures, including the proc::proc.running() check referenced in src/stream.cpp. Reproduce on Windows with Desktop Duplication, two displays, and the stated output configuration, using the linked Sunshine and Moonlight logs for timing. Done means an unchanged active session no longer triggers an unsolicited teardown or loses its connection.
由索引模型根据 Issue 内容生成。
描述
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?
None
Describe the Bug
While actively streaming (no client disconnect, no config change, no app switch), Sunshine periodically logs Starting async encoder teardown on its own, with nothing preceding it that would explain the trigger. Right after, I get:
Warning: Previous active display [\.\DISPLAY1] is no longer present
Error: NvEnc: NvEncOpenEncodeSessionEx() failed: NV_ENC_ERR_NO_ENCODE_DEVICE
repeated dozens to hundreds of times over a few seconds. It sometimes also briefly mentions my secondary monitor ([\.\DISPLAY5]) even though that's not the active capture target. The session usually recovers on its own within a few seconds (correctly re-acquiring the right GPU), but sometimes drops the client entirely and I have to reconnect.
On the Moonlight client side, the log shows this is a server-initiated termination, not a network issue:
SDL Info (0): Server notified termination reason: 0x80030023
SDL Error (0): Connection terminated: 0
I traced 0x80030023 into src/stream.cpp - it's sent as a "graceful termination" reason when the main server loop's proc::proc.running() == 0 check trips.
Setup: RTX 5070 Ti, two monitors (primary 4K/144Hz HDR TV via output_name pinned to its device_id, secondary 4K/240Hz monitor), Windows 11 Pro, LAN-only streaming.
Before reporting, I spent a while ruling out anything on my end that could explain it:
Screensaver and display sleep timeout - both confirmed disabled
A machine-inactivity lock policy - not configured
Scheduled tasks on a matching interval - none found
Windows/NVIDIA driver crash or TDR - Event Viewer (System + Application) is completely silent at the exact failure timestamps, down to the second
Parsec (installed but not running) - ruled out
Second monitor being the trigger - tested by switching Windows to single-display mode and restarting Sunshine fresh; the identical teardown still happened, and the log still referenced the secondary display even though Windows wasn't using it
An active RDP session stealing the interactive session - this turned out to be a real, separate issue on my end (fixed by disconnecting RDP before connecting), but this specific teardown still happens with RDP fully disconnected and the console session properly active
Under a clean isolated test (one connection, nothing else changed), two consecutive occurrences were exactly 60 minutes 1 second apart. Other times it's been anywhere from ~90 seconds to ~50 minutes, so I don't think it's on a fixed timer - feels more like it's reacting to some internal state/condition I can't see from the logs.
One thing that helped: explicitly pinning output_name to my primary display's device_id stopped it from occasionally grabbing my secondary monitor's much weaker integrated GPU when this happens, which was making the symptom a lot worse (resolution mismatch on recovery). It didn't stop the teardown itself though.
Expected Behavior
The encoder/capture pipeline shouldn't tear itself down and briefly fail mid-session without an external trigger (client disconnect, display topology change, config change). If this is an intentional periodic re-validation of some kind, it shouldn't cause NVENC session failures or brief display loss on a completely unchanged display configuration.
Additional Context
No response
Host Operating System
Windows
Operating System Version
10.0.26200
Architecture
amd64/x86_64
Package
Windows - msi installer (recommended)
GPU Type
NVIDIA
GPU Model
NVIDIA GeForce RTX 5070 Ti
GPU Driver/Mesa Version
32.0.16.1692
Capture Method
Desktop Duplication API (Windows)
Apps
Note: I'm using a custom cmd for "Desktop" (a hidden VBScript that does nothing but keep a real process alive) instead of the default empty-cmd placebo mode - that's an unrelated workaround for a different issue (Sunshine's proc::running() treating a cmd-less Desktop app as always "running" via a placebo flag, which breaks if terminate() ever fires). Mentioning it so the odd-looking app entry doesn't cause confusion - this bug reproduces independent of that.
{
"env": {},
"apps": [
{
"name": "Desktop",
"cmd": "wscript.exe //B \"C:\\Program Files\\Sunshine\\scripts\\keepalive.vbs\"",
"auto-detach": false,
"image-path": "desktop.png"
},
{
"name": "Steam Big Picture",
"cmd": "steam://open/bigpicture",
"prep-cmd": [{"do": "", "undo": "steam://close/bigpicture"}],
"auto-detach": true,
"wait-all": true,
"image-path": "steam.png"
}
]
}
Log output
See readme.md and sunshine_server.log and moonlight_client.log in the gist url below.
Online logs
https://gist.github.com/miahmartin/6e456fd14da7c3f5f76cc3bbbf8b69e7
- 主要语言
- C++
- 星标
- 43k
- 派生
- 2.4k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
LizardByte/Sunshine 的其他 Issue
-
Linux keyboard backend has no mapping for VK_ABNT_C1 (ABNT2 dedicated `/ ?` key) — key is silently dropped可能已有人在做 @NestorBrasileiro 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
LizardByte/Sunshine#6051 · 2 条评论 ·
-
PIN pairing fails with "Missing CSRF token" - web UI never fetches/attaches the token可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
LizardByte/Sunshine#5467 · 2 条评论 ·
-
LizardByte/Sunshine#6230 · 5 条评论 ·
-
Virtual HID Driver License notifications appearing even though Enable Gamepad Input is unchecked未关闭
难度 3/5 1-2 天 新手友好度 65/100
LizardByte/Sunshine#6222 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 47/100
LizardByte/Sunshine#6208 ·
查看 LizardByte/Sunshine 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 2 天内回复
-
bug data-types
难度 2/5 1-3 小时 新手友好度 76/100
ClickHouse/clickhouse-cpp#645 ·
维护者通常 1 天内回复
-
bug compatibility difficulty:easy prio:normal
难度 2/5 1-3 小时 新手友好度 74/100
NatronGitHub/openfx-misc#524 ·
维护者通常 1 天内回复
-
documentation enhancement help wanted P0
难度 2/5 1-3 小时 新手友好度 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
维护者通常 1 天内回复
-
Type: Bug
难度 2/5 1-3 小时 新手友好度 82/100
openscad/openscad#7360 · 2 条评论 ·
维护者通常 1 天内回复