Skip to content

Crashes on startup when started from Windows service, but works when started manually #4402

@BrickBee

Description

@BrickBee

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

The service that's installed by default starts sunshine and it crashes almost immediately. This repeats every few seconds, leading to a mouse cursor that signals activity, and to a non-working sunshine.

When I stop the service and start sunshine.exe manually then it works just fine (video/audio streaming, gamepad, ...)

It appears to crash due to a call to abort(). The error in the Windows event log is: 0xc0000409 in ucrtbase.dll

Here is the callstack for the debug executable of v2025.924.154138. It also occurs for pre-release v2025.1027.181930, just with differing line numbers.

ucrtbase!abort+0x4e
sunshine!opus_custom_decoder_create+0x18bb9bd
sunshine!opus_custom_decoder_create+0x16e4fc6
sunshine!opus_custom_decoder_create+0x1a3cdc3
sunshine!opus_custom_decoder_create+0x1a0e116
sunshine!winrt::throw_hresult+0x317 [D:/a/_temp/msys64/ucrt64/include/winrt/base.h @ 4960] 
sunshine!opus_custom_decoder_create+0x1a00976
sunshine!winrt::impl::factory_cache_entry<winrt::Windows::Graphics::Capture::GraphicsCaptureSession, winrt::Windows::Graphics::Capture::IGraphicsCaptureSessionStatics>::call<bool (*)(const winrt::Windows::Graphics::Capture::IGraphicsCaptureSessionStatics&)>+0xc2 [D:/a/_temp/msys64/ucrt64/include/winrt/base.h @ 6425] 
sunshine!platf::dxgi::wgc_capture_t::init+0x51c [D:/a/_temp/msys64/ucrt64/include/winrt/base.h @ 6464] 
sunshine!platf::dxgi::display_wgc_vram_t::init+0x27 [D:/a/Sunshine/Sunshine/src/platform/windows/display_vram.cpp @ 1701] 
sunshine!platf::display+0x493 [D:/a/Sunshine/Sunshine/src/platform/windows/display_base.cpp @ 1009] 
sunshine!video::reset_display+0x75 [D:/a/_temp/msys64/ucrt64/include/c++/15.2.0/bits/shared_ptr_base.h @ 1539] 
sunshine!video::validate_encoder+0x201 [D:/a/_temp/msys64/ucrt64/include/c++/15.2.0/bits/shared_ptr_base.h @ 1677] 
sunshine!video::probe_encoders+0x371 [D:/a/Sunshine/Sunshine/src/video.cpp @ 2670] 
sunshine!main+0xf54 [D:/a/Sunshine/Sunshine/src/main.cpp @ 345] 

Some symbols from the msys side appear to be missing. The last line executed on the Sunshine side is this:

if (display_base_t::init(config, display_name) || dup.init(this, config)) {

I assumed that the application didn't have access to the desktop / GFX card when started via service, yet enabling "Allow service to interact with desktop" in the service properties didn't fix it. Letting the service run via local account instead of the system account merely led to sunshine.exe not being started at all.

Expected Behavior

No response

Additional Context

No response

Host Operating System

Windows

Operating System Version

Windows 10 21H2

Architecture

amd64/x86_64

Sunshine commit or version

v2025.924.154138

Package

Windows - installer (recommended)

GPU Type

NVIDIA

GPU Model

Nvidia RTX 3090

GPU Driver/Mesa Version

581.57

Capture Method

Windows.Graphics.Capture (Windows)

Config

Apps

Relevant log output

No log output when started from service.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions