Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

wgc: terminate called after throwing an instance of 'std::bad_alloc'

Open brian6932 opened this issue 1 year ago • 8 comments

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

This only happens when the program is ran as SYSTEM, this is important because services are ran as SYSTEM. Workaround for now, would be to either use capture = ddx, or run the program as the current user with Task Scheduler, an xml file can be added to the repo, and imported with a script.

287ac4c0fbb0df96cd7d83f1c16cf84070eb50d1 (wgc)
❯ wsudo -S ./sunshine.exe
new System process is running: 20936
[chromaSamplingType] -- [1]
[dynamicRange] -- [0]
[origin_web_ui_allowed] -- [wan]
[encoderCscMode] -- [1]
[encoder] -- [nvenc]
[nv_rc] -- [cbr]
[capture] -- [wgc]
[address_family] -- [both]
[nvenc_twopass] -- [disabled]
[upnp] -- [on]
Warning: Unrecognized configurable option [chromaSamplingType]
Warning: Unrecognized configurable option [dynamicRange]
Warning: Unrecognized configurable option [encoderCscMode]
Warning: Unrecognized configurable option [nv_rc]
[2024:08:21:11:31:40]: Info: Sunshine version: v2024.527.181617
[2024:08:21:11:31:40]: Info: nvprefs: No need to modify application profile settings
[2024:08:21:11:31:40]: Info: nvprefs: Changed OGL_CPL_PREFER_DXPRESENT to OGL_CPL_PREFER_DXPRESENT_PREFER_ENABLED for base profile
[2024:08:21:11:31:40]: Info: Compiling shaders...
[2024:08:21:11:31:40]: Info: Compiled shaders
[2024:08:21:11:31:40]: Info: System tray created
[2024:08:21:11:31:40]: Fatal: ViGEmBus is not installed or running. You must install ViGEmBus for gamepad support!
[2024:08:21:11:31:40]: Info: Trying encoder [nvenc]
[2024:08:21:11:31:41]: Info: ddprobe.exe [1] [] returned: 0x00000000
[2024:08:21:11:31:41]: Info: Set GPU preference: 1
[2024:08:21:11:31:41]: Info:
Device Description : NVIDIA GeForce GTX 1080 Ti
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00001B06
Device Video Mem   : 11107 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8154 MiB
Feature Level      : 0x0000B100
Capture size       : 2560x1440
Offset             : 0x0
Virtual Desktop    : 2560x1440
[2024:08:21:11:31:41]: Info: Active GPU has HAGS enabled
[2024:08:21:11:31:41]: Info: Using realtime GPU priority
[2024:08:21:11:31:41]: Info:
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.639648,0.330078]
Green Primary      : [0.299805,0.599609]
Blue Primary       : [0.150391,0.0595703]
White Point        : [0.3125,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
287ac4c0fbb0df96cd7d83f1c16cf84070eb50d1 (ddx)
❯ wsudo -S ./sunshine.exe
new System process is running: 14280
[chromaSamplingType] -- [1]
[dynamicRange] -- [0]
[origin_web_ui_allowed] -- [wan]
[encoderCscMode] -- [1]
[encoder] -- [nvenc]
[nv_rc] -- [cbr]
[capture] -- [ddx]
[address_family] -- [both]
[nvenc_twopass] -- [disabled]
[upnp] -- [on]
Warning: Unrecognized configurable option [chromaSamplingType]
Warning: Unrecognized configurable option [dynamicRange]
Warning: Unrecognized configurable option [encoderCscMode]
Warning: Unrecognized configurable option [nv_rc]
[2024:08:21:11:44:05]: Info: Sunshine version: v2024.527.181617
[2024:08:21:11:44:05]: Info: nvprefs: Opened undo file from previous improper termination
[2024:08:21:11:44:05]: Info: nvprefs: Restored OGL_CPL_PREFER_DXPRESENT for base profile
[2024:08:21:11:44:05]: Info: nvprefs: Restored global profile settings from undo file - deleting the file
[2024:08:21:11:44:05]: Info: nvprefs: No need to modify application profile settings
[2024:08:21:11:44:05]: Info: nvprefs: Changed OGL_CPL_PREFER_DXPRESENT to OGL_CPL_PREFER_DXPRESENT_PREFER_ENABLED for base profile
[2024:08:21:11:44:05]: Info: Compiling shaders...
[2024:08:21:11:44:05]: Info: Compiled shaders
[2024:08:21:11:44:05]: Fatal: ViGEmBus is not installed or running. You must install ViGEmBus for gamepad support!
[2024:08:21:11:44:05]: Info: Trying encoder [nvenc]
[2024:08:21:11:44:05]: Info: System tray created
[2024:08:21:11:44:06]: Info: ddprobe.exe [1] [] returned: 0x00000000
[2024:08:21:11:44:06]: Info: Set GPU preference: 1
[2024:08:21:11:44:06]: Info:
Device Description : NVIDIA GeForce GTX 1080 Ti
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00001B06
Device Video Mem   : 11107 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8154 MiB
Feature Level      : 0x0000B100
Capture size       : 2560x1440
Offset             : 0x0
Virtual Desktop    : 2560x1440
[2024:08:21:11:44:06]: Info: Active GPU has HAGS enabled
[2024:08:21:11:44:06]: Info: Using realtime GPU priority
[2024:08:21:11:44:06]: Info:
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.639648,0.330078]
Green Primary      : [0.299805,0.599609]
Blue Primary       : [0.150391,0.0595703]
White Point        : [0.3125,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
[2024:08:21:11:44:06]: Info: Desktop resolution [2560x1440]
[2024:08:21:11:44:06]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2024:08:21:11:44:06]: Info: Display refresh rate [165Hz]
[2024:08:21:11:44:06]: Info: Requested frame rate [60fps]
[2024:08:21:11:44:06]: Info: SDR color coding [Rec. 601]
[2024:08:21:11:44:06]: Info: Color depth: 8-bit
[2024:08:21:11:44:06]: Info: Color range: [JPEG]
[2024:08:21:11:44:06]: Info: NvEnc: created encoder P1
[2024:08:21:11:44:06]: Info: SDR color coding [Rec. 601]
[2024:08:21:11:44:06]: Info: Color depth: 8-bit
[2024:08:21:11:44:06]: Info: Color range: [JPEG]
[2024:08:21:11:44:06]: Info: NvEnc: created encoder P1
[2024:08:21:11:44:06]: Info: SDR color coding [Rec. 601]
[2024:08:21:11:44:06]: Info: Color depth: 8-bit
[2024:08:21:11:44:06]: Info: Color range: [JPEG]
[2024:08:21:11:44:06]: Error: NvEnc: encoding format is not supported by the gpu
[2024:08:21:11:44:07]: Info:
Device Description : NVIDIA GeForce GTX 1080 Ti
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00001B06
Device Video Mem   : 11107 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 8154 MiB
Feature Level      : 0x0000B100
Offset             : 0x0
Virtual Desktop    : 2560x1440
[2024:08:21:11:44:07]: Info: Active GPU has HAGS enabled
[2024:08:21:11:44:07]: Info: Using realtime GPU priority
[2024:08:21:11:44:07]: Info:
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.639648,0.330078]
Green Primary      : [0.299805,0.599609]
Blue Primary       : [0.150391,0.0595703]
White Point        : [0.3125,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
[2024:08:21:11:44:07]: Info: Desktop resolution [2560x1440]
[2024:08:21:11:44:07]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2024:08:21:11:44:07]: Info: Display refresh rate [165Hz]
[2024:08:21:11:44:07]: Info: Requested frame rate [60fps]
[2024:08:21:11:44:07]: Info: SDR color coding [Rec. 709]
[2024:08:21:11:44:07]: Info: Color depth: 10-bit
[2024:08:21:11:44:07]: Info: Color range: [JPEG]
[2024:08:21:11:44:07]: Info: NvEnc: created encoder P1 10-bit
[2024:08:21:11:44:07]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:08:21:11:44:07]: Info:
[2024:08:21:11:44:07]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:08:21:11:44:07]: Info:
[2024:08:21:11:44:07]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2024:08:21:11:44:07]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2024:08:21:11:44:07]: Info: Open the Web UI to set your new username and password and getting started
[2024:08:21:11:44:07]: Info: File ...\Sunshine\config\sunshine_state.json doesn't exist
[2024:08:21:11:44:07]: Info: Configuration UI available at [https://localhost:47990]
[2024:08:21:11:44:08]: Info: Registered Sunshine mDNS service
Socket error: connect, 10013
Socket error: connect, 10013
[2024:08:21:11:44:10]: Error: No IGD device found
[2024:08:21:11:44:20]: Info: Interrupt handler called
[2024:08:21:11:44:20]: Info: nvprefs: Restored OGL_CPL_PREFER_DXPRESENT for base profile
[2024:08:21:11:44:20]: Info: Unregistered Sunshine mDNS service

Related:

  • https://github.com/LizardByte/Sunshine/pull/2149#issuecomment-1955746301
  • https://github.com/LizardByte/Sunshine/issues/2846

Expected Behavior

If wgc can't be ran as SYSTEM, a user check condition should be added, then throw, and there should be some relevant documentation regarding this.

Host Operating System

Windows

Operating System Version

10

Architecture

64 bit

Sunshine commit or version

287ac4c0fbb0df96cd7d83f1c16cf84070eb50d1

Package

Windows - portable

Capture Method

Windows.Graphics.Capture (Windows)

Config

upnp = on
address_family = both
encoder = nvenc
nvenc_twopass = disabled
nv_rc = cbr
encoderCscMode = 1
dynamicRange = 0
chromaSamplingType = 1
origin_web_ui_allowed = wan

brian6932 avatar Aug 21 '24 16:08 brian6932

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

LizardByte-bot avatar Nov 20 '24 10:11 LizardByte-bot

Not stale

brian6932 avatar Nov 20 '24 14:11 brian6932

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

LizardByte-bot avatar Feb 19 '25 10:02 LizardByte-bot

Not stale.

brian6932 avatar Feb 19 '25 15:02 brian6932

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

LizardByte-bot avatar May 21 '25 10:05 LizardByte-bot

Keep open.

brian6932 avatar May 21 '25 10:05 brian6932

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

LizardByte-bot avatar Aug 21 '25 10:08 LizardByte-bot

Keep open.

brian6932 avatar Aug 22 '25 00:08 brian6932

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

LizardByte-bot avatar Nov 20 '25 10:11 LizardByte-bot

Keep open.

brian6932 avatar Nov 20 '25 14:11 brian6932