LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
20.13k stars 965 forks source link

Sunshine 0.22 crash when connected on Wayland KDE Plasma #2215

Closed lithces closed 8 months ago

lithces commented 8 months ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the nightly release?

Describe the Bug

I upgrade sunshine from 0.21 to 0.22 and I could not connect from moonlight anymore. Once the connection is established, on sunshine side I get the following error,

/usr/include/c++/13.2.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = unsigned char; _Alloc = std::allocator<unsigned char>; reference = unsigned char&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
zsh: IOT instruction  sunshine

I am running Manjaro KDE Plasma using "software" encoder, and I tried both PKGBUILD provided by sunshine and AUR. Same error. I also tried to switch encoder from software to NVenc, same error.

Any ideas?

Expected Behavior

Sunshine wont crash o=upon connection

Additional Context

No response

Host Operating System

Linux

Operating System Version

Manjaro

Architecture

64 bit

Sunshine commit or version

0.22

Package

Linux - PKGBUILD

GPU Type

none (software encoding)

GPU Model

RTX 4090 laptop

GPU Driver/Mesa Version

545.29.06 =

Capture Method (Linux Only)

kms

Config

#capture = kms
#adapter_name = /dev/dri/renderD129
encoder = software

Apps

No response

Relevant log output

[encoder] -- [software]
[2024:03:05:10:34:52]: Info: Sunshine version: 0.22.0
[2024:03:05:10:34:52]: Info: Found display [wayland-0]
[2024:03:05:10:34:52]: Info: Found interface: zxdg_output_manager_v1(32) version 3
[2024:03:05:10:34:52]: Info: Found interface: wl_output(77) version 4
[2024:03:05:10:34:52]: Warning: Missing Wayland wire for wlr-export-dmabuf
[2024:03:05:10:34:52]: Info: Found display [wayland-0]
[2024:03:05:10:34:52]: Info: Found display [wayland-0]
[2024:03:05:10:34:52]: Info: Found interface: zxdg_output_manager_v1(32) version 3
[2024:03:05:10:34:52]: Info: Found interface: wl_output(77) version 4
[2024:03:05:10:34:52]: Info: Resolution: 2560x1600
[2024:03:05:10:34:52]: Info: Offset: 0x0
[2024:03:05:10:34:52]: Info: Logical size: 2048x1280
[2024:03:05:10:34:52]: Info: Name: eDP-1
[2024:03:05:10:34:52]: Info: Found monitor: BOE 1
[2024:03:05:10:34:52]: Info: -------- Start of KMS monitor list --------
[2024:03:05:10:34:52]: Info: --------- End of KMS monitor list ---------
[2024:03:05:10:34:52]: Info: Trying encoder [software]
[2024:03:05:10:34:52]: Info: Screencasting with KMS
[2024:03:05:10:34:52]: Info: System tray created
[2024:03:05:10:34:52]: Info: Found monitor for DRM screencasting
[2024:03:05:10:34:52]: Info: Found connector ID [236]
[2024:03:05:10:34:52]: Info: Found cursor plane [76]
[2024:03:05:10:34:52]: Info: SDR color coding [Rec. 601]
[2024:03:05:10:34:52]: Info: Color depth: 8-bit
[2024:03:05:10:34:52]: Info: Color range: [JPEG]
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] profile High, level 4.2, 4:2:0, 8-bit
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] frame I:1     Avg QP:31.00  size:  1203
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] mb I  I16..4: 99.9%  0.0%  0.0%
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] 8x8 transform intra:0.0%
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0%
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] i16 v,h,dc,p: 97%  0%  3%  0%
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 75% 12%  0%  0%  0%  0% 12%
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 100%  0%  0%  0%  0%  0%  0%
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] i8c dc,h,v,p: 100%  0%  0%  0%
[2024:03:05:10:34:52]: Info: [libx264 @ 0x562f58e07780] kb/s:577.44
[2024:03:05:10:34:52]: Info: Screencasting with KMS
[2024:03:05:10:34:52]: Info: Found monitor for DRM screencasting
[2024:03:05:10:34:52]: Info: Found connector ID [236]
[2024:03:05:10:34:52]: Info: Found cursor plane [76]
[2024:03:05:10:34:52]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:03:05:10:34:52]: Info: 
[2024:03:05:10:34:52]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:03:05:10:34:52]: Info: 
[2024:03:05:10:34:52]: Info: Found H.264 encoder: libx264 [software]
[2024:03:05:10:34:52]: Info: Adding avahi service Sunshine
[2024:03:05:10:34:52]: Info: Configuration UI available at [https://localhost:47990]
[2024:03:05:10:34:53]: Info: Avahi service Sunshine successfully established.
[2024:03:05:10:35:09]: Info: Trying encoder [software]
[2024:03:05:10:35:09]: Info: Screencasting with KMS
[2024:03:05:10:35:11]: Info: Found monitor for DRM screencasting
[2024:03:05:10:35:11]: Info: Found connector ID [236]
[2024:03:05:10:35:11]: Info: Found cursor plane [76]
[2024:03:05:10:35:11]: Info: SDR color coding [Rec. 601]
[2024:03:05:10:35:11]: Info: Color depth: 8-bit
[2024:03:05:10:35:11]: Info: Color range: [JPEG]
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] profile High, level 4.2, 4:2:0, 8-bit
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] frame I:1     Avg QP:31.00  size:  1203
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] mb I  I16..4: 99.9%  0.0%  0.0%
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] 8x8 transform intra:0.0%
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0%
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] i16 v,h,dc,p: 97%  0%  3%  0%
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 75% 12%  0%  0%  0%  0% 12%
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 100%  0%  0%  0%  0%  0%  0%
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] i8c dc,h,v,p: 100%  0%  0%  0%
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0c813ddc0] kb/s:577.44
[2024:03:05:10:35:11]: Info: Screencasting with KMS
[2024:03:05:10:35:11]: Info: Found monitor for DRM screencasting
[2024:03:05:10:35:11]: Info: Found connector ID [236]
[2024:03:05:10:35:11]: Info: Found cursor plane [76]
[2024:03:05:10:35:11]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:03:05:10:35:11]: Info: 
[2024:03:05:10:35:11]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:03:05:10:35:11]: Info: 
[2024:03:05:10:35:11]: Info: Found H.264 encoder: libx264 [software]
[2024:03:05:10:35:11]: Info: Executing [Desktop]
[2024:03:05:10:35:11]: Info: CLIENT CONNECTED
[2024:03:05:10:35:11]: Info: Found display [wayland-0]
[2024:03:05:10:35:11]: Info: Found interface: zxdg_output_manager_v1(32) version 3
[2024:03:05:10:35:11]: Info: Found interface: wl_output(77) version 4
[2024:03:05:10:35:11]: Info: Resolution: 2560x1600
[2024:03:05:10:35:11]: Info: Offset: 0x0
[2024:03:05:10:35:11]: Info: Logical size: 2048x1280
[2024:03:05:10:35:11]: Info: Name: eDP-1
[2024:03:05:10:35:11]: Info: Found monitor: BOE 1
[2024:03:05:10:35:11]: Info: -------- Start of KMS monitor list --------
[2024:03:05:10:35:11]: Info: --------- End of KMS monitor list ---------
[2024:03:05:10:35:11]: Info: Screencasting with KMS
[2024:03:05:10:35:11]: Info: Found monitor for DRM screencasting
[2024:03:05:10:35:11]: Info: Found connector ID [236]
[2024:03:05:10:35:11]: Info: Found cursor plane [76]
[2024:03:05:10:35:11]: Info: SDR color coding [Rec. 601]
[2024:03:05:10:35:11]: Info: Color depth: 8-bit
[2024:03:05:10:35:11]: Info: Color range: [MPEG]
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0b00021c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[2024:03:05:10:35:11]: Info: [libx264 @ 0x7fc0b00021c0] profile High, level 3.2, 4:2:0, 8-bit
/usr/include/c++/13.2.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = unsigned char; _Alloc = std::allocator<unsigned char>; reference = unsigned char&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
cgutman commented 8 months ago

That is strange that it seems to detect no monitors. Can you try to set min_log_level=0 in your config file and attach a new log?

Also are you running the open or proprietary Nvidia kernel module? Does your laptop have a display physically connected to your Nvidia GPU or is it driving the display with integrated graphics?

lithces commented 8 months ago

sunshine.log

See attachment for the log. After the error message I got the same error /usr/include/c++/13.2.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = unsigned char; _Alloc = std::allocator<unsigned char>; reference = unsigned char&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

cgutman commented 8 months ago

Thanks for the logs. I tried for a while to reproduce this issue with a similar setup (545.29.06 proprietary driver with T400 GPU on KDE Plasma 6) and wasn't able to.

Can you run Sunshine under the debugger to get the exact crash location? It will need to be run as root which means it will end up using a different config location, so you'll need to run it once with sudo sunshine to create the config files and set your credentials (it will not overwrite your existing ones).

After that, you can run:

sudo gdb sunshine

then type r at the prompt to run.

Once it crashes, it will show the debugger prompt again, type thread apply all bt full, then post the full output of that command.

nougatbyte commented 8 months ago

I'm pretty sure I have the same issue.

Happened to me after I did pacman -Syu in endeavouros. Driver is also proprietary Nvidia. Config is Default (First time started via sudo):

Edit: I just noticed that my log (created via sudo gdb sunshine > /tmp/gdb) is missing the stl_vector.h error message. In the terminal it appears before "Thread 74".

This is my gdb output:

GNU gdb (GDB) 14.2 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from sunshine... Reading symbols from /usr/lib/debug/usr/bin/sunshine-0.22.0.debug... (gdb) r Starting program: /usr/bin/sunshine [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". [New Thread 0x7ffff1e006c0 (LWP 8064)] [2024:03:07:02:09:46]: Info: Sunshine version: 0.22.0 [New Thread 0x7ffff14006c0 (LWP 8065)] [New Thread 0x7ffff0a006c0 (LWP 8066)] [2024:03:07:02:09:46]: Error: Environment variable WAYLAND_DISPLAY has not been defined [2024:03:07:02:09:46]: Info: Detecting monitors [2024:03:07:02:09:46]: Info: Detected monitor 0: DP-3, connected: true [New Thread 0x7fffeb4006c0 (LWP 8067)] [New Thread 0x7fffe8c006c0 (LWP 8068)] [Detaching after fork from child process 8069] [Detaching after fork from child process 8070] [New Thread 0x7fffe0c006c0 (LWP 8071)] [2024:03:07:02:09:46]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. // [2024:03:07:02:09:46]: Info: Trying encoder [nvenc] [2024:03:07:02:09:46]: Info: Screencasting with KMS [2024:03:07:02:09:46]: Info: Found monitor for DRM screencasting [2024:03:07:02:09:46]: Info: Found connector ID [90] [2024:03:07:02:09:46]: Info: Found cursor plane [38] [2024:03:07:02:09:46]: Warning: Attempting to use NVENC without CUDA support. Reverting back to GPU -> RAM -> GPU [2024:03:07:02:09:46]: Info: Found monitor for DRM screencasting [2024:03:07:02:09:46]: Info: Found connector ID [90] [2024:03:07:02:09:46]: Info: Found cursor plane [38] [Detaching after fork from child process 8078] [2024:03:07:02:09:46]: Info: System tray created [2024:03:07:02:09:46]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:46]: Info: Color depth: 8-bit [2024:03:07:02:09:46]: Info: Color range: [JPEG] [New Thread 0x7fffd3e006c0 (LWP 8080)] [New Thread 0x7fffd22006c0 (LWP 8082)] [New Thread 0x7fffcbe006c0 (LWP 8083)] [New Thread 0x7fffca4006c0 (LWP 8084)] [2024:03:07:02:09:46]: Warning: [h264_nvenc @ 0x555556c5b080] Multiple reference frames are not supported by the device [2024:03:07:02:09:46]: Error: [h264_nvenc @ 0x555556c5b080] Provided device doesn't support required NVENC features [New Thread 0x7fffc9a006c0 (LWP 8091)] [Thread 0x7fffca4006c0 (LWP 8084) exited] [Thread 0x7fffcbe006c0 (LWP 8083) exited] [Thread 0x7fffd22006c0 (LWP 8082) exited] [2024:03:07:02:09:46]: Error: Could not open codec [h264_nvenc]: Function not implemented [2024:03:07:02:09:46]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:46]: Info: Color depth: 8-bit [2024:03:07:02:09:46]: Info: Color range: [JPEG] [New Thread 0x7fffd22006c0 (LWP 8105)] [New Thread 0x7fffcbe006c0 (LWP 8106)] [New Thread 0x7fffca4006c0 (LWP 8107)] [New Thread 0x7fffc8a006c0 (LWP 8108)] [New Thread 0x7fffc30006c0 (LWP 8109)] [Thread 0x7fffc8a006c0 (LWP 8108) exited] [Thread 0x7fffca4006c0 (LWP 8107) exited] [Thread 0x7fffc30006c0 (LWP 8109) exited] [Thread 0x7fffcbe006c0 (LWP 8106) exited] [Thread 0x7fffd22006c0 (LWP 8105) exited] [2024:03:07:02:09:46]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:46]: Info: Color depth: 8-bit [2024:03:07:02:09:46]: Info: Color range: [JPEG] [New Thread 0x7fffd22006c0 (LWP 8110)] [New Thread 0x7fffcbe006c0 (LWP 8111)] [New Thread 0x7fffc30006c0 (LWP 8112)] [2024:03:07:02:09:46]: Warning: [hevc_nvenc @ 0x555556c5b080] Multiple reference frames are not supported by the device [2024:03:07:02:09:46]: Error: [hevc_nvenc @ 0x555556c5b080] Provided device doesn't support required NVENC features [Thread 0x7fffc30006c0 (LWP 8112) exited] [Thread 0x7fffcbe006c0 (LWP 8111) exited] [Thread 0x7fffd22006c0 (LWP 8110) exited] [2024:03:07:02:09:47]: Error: Could not open codec [hevc_nvenc]: Function not implemented [2024:03:07:02:09:47]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:47]: Info: Color depth: 8-bit [2024:03:07:02:09:47]: Info: Color range: [JPEG] [New Thread 0x7fffd22006c0 (LWP 8113)] [New Thread 0x7fffcbe006c0 (LWP 8114)] [New Thread 0x7fffc30006c0 (LWP 8115)] [New Thread 0x7fffca4006c0 (LWP 8116)] [New Thread 0x7fffc26006c0 (LWP 8117)] [Thread 0x7fffca4006c0 (LWP 8116) exited] [Thread 0x7fffc30006c0 (LWP 8115) exited] [Thread 0x7fffc26006c0 (LWP 8117) exited] [Thread 0x7fffcbe006c0 (LWP 8114) exited] [Thread 0x7fffd22006c0 (LWP 8113) exited] [2024:03:07:02:09:47]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:47]: Info: Color depth: 8-bit [2024:03:07:02:09:47]: Info: Color range: [JPEG] [New Thread 0x7fffd22006c0 (LWP 8118)] [New Thread 0x7fffcbe006c0 (LWP 8119)] [New Thread 0x7fffc26006c0 (LWP 8120)] [2024:03:07:02:09:47]: Warning: [av1_nvenc @ 0x555556c5b080] Codec not supported [2024:03:07:02:09:47]: Error: [av1_nvenc @ 0x555556c5b080] Provided device doesn't support required NVENC features [Thread 0x7fffc26006c0 (LWP 8120) exited] [Thread 0x7fffcbe006c0 (LWP 8119) exited] [Thread 0x7fffd22006c0 (LWP 8118) exited] [2024:03:07:02:09:47]: Error: Could not open codec [av1_nvenc]: Function not implemented [2024:03:07:02:09:47]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:47]: Info: Color depth: 8-bit [2024:03:07:02:09:47]: Info: Color range: [JPEG] [New Thread 0x7fffd22006c0 (LWP 8121)] [New Thread 0x7fffcbe006c0 (LWP 8122)] [New Thread 0x7fffc26006c0 (LWP 8123)] [2024:03:07:02:09:47]: Warning: [av1_nvenc @ 0x555556c5b080] Codec not supported [2024:03:07:02:09:47]: Error: [av1_nvenc @ 0x555556c5b080] Provided device doesn't support required NVENC features [Thread 0x7fffc26006c0 (LWP 8123) exited] [Thread 0x7fffcbe006c0 (LWP 8122) exited] [Thread 0x7fffd22006c0 (LWP 8121) exited] [2024:03:07:02:09:47]: Error: Could not open codec [av1_nvenc]: Function not implemented [2024:03:07:02:09:47]: Info: Screencasting with KMS [2024:03:07:02:09:47]: Info: Found monitor for DRM screencasting [2024:03:07:02:09:47]: Info: Found connector ID [90] [2024:03:07:02:09:47]: Info: Found cursor plane [38] [2024:03:07:02:09:47]: Warning: Attempting to use NVENC without CUDA support. Reverting back to GPU -> RAM -> GPU [2024:03:07:02:09:47]: Info: Found monitor for DRM screencasting [2024:03:07:02:09:47]: Info: Found connector ID [90] [2024:03:07:02:09:47]: Info: Found cursor plane [38] [2024:03:07:02:09:47]: Info: SDR color coding [Rec. 709] [2024:03:07:02:09:47]: Info: Color depth: 10-bit [2024:03:07:02:09:47]: Info: Color range: [JPEG] [New Thread 0x7fffd22006c0 (LWP 8124)] [New Thread 0x7fffcbe006c0 (LWP 8125)] New Thread 0x7fffc26006c0 (LWP 8126): Warning: [hevc_nvenc @ 0x555556c5b080] 10 bit encode not supported 2024:03:07:02:09:48: Error: [hevc_nvenc @ 0x555556c5b080] Provided device doesn't support required NVENC features [Thread 0x7fffc26006c0 (LWP 8126) exited] [Thread 0x7fffcbe006c0 (LWP 8125) exited] Thread 0x7fffd22006c0 (LWP 8124) exited: Error: Could not open codec [hevc_nvenc]: Function not implemented

2024:03:07:02:09:48: Info: // Ignore any errors mentioned above, they are not relevant. //

2024:03:07:02:09:48: Info: Found H.264 encoder: h264_nvenc nvenc: Info: Found HEVC encoder: hevc_nvenc [nvenc] [New Thread 0x7fffd22006c0 (LWP 8127)] [New Thread 0x7fffcbe006c0 (LWP 8128)] [Thread 0x7fffcbe006c0 (LWP 8128) exited] [New Thread 0x7fffc26006c0 (LWP 8129)] [New Thread 0x7fffc30006c0 (LWP 8130)] [New Thread 0x7fffd18006c0 (LWP 8131)] [New Thread 0x7fffd0e006c0 (LWP 8132)] New Thread 0x7fffcb4006c0 (LWP 8133): Info: Configuration UI available at https://localhost:47990: Info: Adding avahi service Sunshine [New Thread 0x7fffcaa006c0 (LWP 8134)] [Thread 0x7fffd22006c0 (LWP 8127) exited] [2024:03:07:02:09:49]: Info: Avahi service Sunshine successfully established. [2024:03:07:02:09:54]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. // [2024:03:07:02:09:54]: Info: Trying encoder [nvenc] [2024:03:07:02:09:54]: Info: Screencasting with KMS [2024:03:07:02:09:54]: Info: Found monitor for DRM screencasting [2024:03:07:02:09:54]: Info: Found connector ID [90] [2024:03:07:02:09:54]: Info: Found cursor plane [38] [2024:03:07:02:09:54]: Warning: Attempting to use NVENC without CUDA support. Reverting back to GPU -> RAM -> GPU [2024:03:07:02:09:54]: Info: Found monitor for DRM screencasting [2024:03:07:02:09:54]: Info: Found connector ID [90] [2024:03:07:02:09:54]: Info: Found cursor plane [38] [2024:03:07:02:09:54]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:54]: Info: Color depth: 8-bit [2024:03:07:02:09:54]: Info: Color range: [JPEG] [New Thread 0x7fffc8a006c0 (LWP 8136)] [New Thread 0x7fffc3e006c0 (LWP 8137)] [New Thread 0x7fffc0a006c0 (LWP 8138)] [2024:03:07:02:09:54]: Warning: [h264_nvenc @ 0x7fffa02d4c40] Multiple reference frames are not supported by the device [2024:03:07:02:09:54]: Error: [h264_nvenc @ 0x7fffa02d4c40] Provided device doesn't support required NVENC features [Thread 0x7fffc0a006c0 (LWP 8138) exited] [Thread 0x7fffc3e006c0 (LWP 8137) exited] [Thread 0x7fffc8a006c0 (LWP 8136) exited] [2024:03:07:02:09:55]: Error: Could not open codec [h264_nvenc]: Function not implemented [2024:03:07:02:09:55]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:55]: Info: Color depth: 8-bit [2024:03:07:02:09:55]: Info: Color range: [JPEG] [New Thread 0x7fffc8a006c0 (LWP 8139)] [New Thread 0x7fffc3e006c0 (LWP 8140)] [New Thread 0x7fffc0a006c0 (LWP 8141)] [New Thread 0x7fffaae006c0 (LWP 8142)] [New Thread 0x7fffaa2006c0 (LWP 8143)] [Thread 0x7fffaae006c0 (LWP 8142) exited] [Thread 0x7fffc0a006c0 (LWP 8141) exited] [Thread 0x7fffaa2006c0 (LWP 8143) exited] [Thread 0x7fffc3e006c0 (LWP 8140) exited] [Thread 0x7fffc8a006c0 (LWP 8139) exited] [2024:03:07:02:09:55]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:55]: Info: Color depth: 8-bit [2024:03:07:02:09:55]: Info: Color range: [JPEG] [New Thread 0x7fffc8a006c0 (LWP 8144)] [New Thread 0x7fffc3e006c0 (LWP 8145)] [New Thread 0x7fffaa2006c0 (LWP 8146)] [2024:03:07:02:09:55]: Warning: [hevc_nvenc @ 0x7fffa02d4c40] Multiple reference frames are not supported by the device [2024:03:07:02:09:55]: Error: [hevc_nvenc @ 0x7fffa02d4c40] Provided device doesn't support required NVENC features [Thread 0x7fffaa2006c0 (LWP 8146) exited] [Thread 0x7fffc3e006c0 (LWP 8145) exited] [Thread 0x7fffc8a006c0 (LWP 8144) exited] [2024:03:07:02:09:55]: Error: Could not open codec [hevc_nvenc]: Function not implemented [2024:03:07:02:09:55]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:55]: Info: Color depth: 8-bit [2024:03:07:02:09:55]: Info: Color range: [JPEG] [New Thread 0x7fffc8a006c0 (LWP 8147)] [New Thread 0x7fffc3e006c0 (LWP 8148)] [New Thread 0x7fffaa2006c0 (LWP 8149)] [New Thread 0x7fffc0a006c0 (LWP 8150)] [New Thread 0x7fffa98006c0 (LWP 8151)] [Thread 0x7fffc0a006c0 (LWP 8150) exited] [Thread 0x7fffaa2006c0 (LWP 8149) exited] [Thread 0x7fffa98006c0 (LWP 8151) exited] [Thread 0x7fffc3e006c0 (LWP 8148) exited] [Thread 0x7fffc8a006c0 (LWP 8147) exited] [2024:03:07:02:09:55]: Info: SDR color coding [Rec. 601] [2024:03:07:02:09:55]: Info: Color depth: 8-bit [2024:03:07:02:09:55]: Info: Color range: [JPEG] [New Thread 0x7fffc8a006c0 (LWP 8152)] [New Thread 0x7fffc3e006c0 (LWP 8153)] New Thread 0x7fffa98006c0 (LWP 8154): Warning: [av1_nvenc @ 0x7fffa02d4c40] Codec not supported 2024:03:07:02:09:56: Error: [av1_nvenc @ 0x7fffa02d4c40] Provided device doesn't support required NVENC features [Thread 0x7fffa98006c0 (LWP 8154) exited] [Thread 0x7fffc3e006c0 (LWP 8153) exited] Thread 0x7fffc8a006c0 (LWP 8152) exited: Error: Could not open codec [av1_nvenc]: Function not implemented 2024:03:07:02:09:56: Info: SDR color coding Rec. 601: Info: Color depth: 8-bit 2024:03:07:02:09:56: Info: Color range: [JPEG] [New Thread 0x7fffc8a006c0 (LWP 8155)] [New Thread 0x7fffc3e006c0 (LWP 8156)] New Thread 0x7fffa98006c0 (LWP 8157): Warning: [av1_nvenc @ 0x7fffa02d4c40] Codec not supported 2024:03:07:02:09:56: Error: [av1_nvenc @ 0x7fffa02d4c40] Provided device doesn't support required NVENC features [Thread 0x7fffa98006c0 (LWP 8157) exited] [Thread 0x7fffc3e006c0 (LWP 8156) exited] Thread 0x7fffc8a006c0 (LWP 8155) exited: Error: Could not open codec [av1_nvenc]: Function not implemented 2024:03:07:02:09:56: Info: Screencasting with KMS 2024:03:07:02:09:56: Info: Found monitor for DRM screencasting 2024:03:07:02:09:56: Info: Found connector ID 90: Info: Found cursor plane 38: Warning: Attempting to use NVENC without CUDA support. Reverting back to GPU -> RAM -> GPU 2024:03:07:02:09:56: Info: Found monitor for DRM screencasting 2024:03:07:02:09:56: Info: Found connector ID 90: Info: Found cursor plane 38: Info: SDR color coding Rec. 709: Info: Color depth: 10-bit 2024:03:07:02:09:56: Info: Color range: [JPEG] [New Thread 0x7fffc8a006c0 (LWP 8158)] [New Thread 0x7fffc3e006c0 (LWP 8159)] New Thread 0x7fffa98006c0 (LWP 8160): Warning: [hevc_nvenc @ 0x7fffa02d4c40] 10 bit encode not supported 2024:03:07:02:09:56: Error: [hevc_nvenc @ 0x7fffa02d4c40] Provided device doesn't support required NVENC features [Thread 0x7fffa98006c0 (LWP 8160) exited] [Thread 0x7fffc3e006c0 (LWP 8159) exited] Thread 0x7fffc8a006c0 (LWP 8158) exited: Error: Could not open codec [hevc_nvenc]: Function not implemented

2024:03:07:02:09:56: Info: // Ignore any errors mentioned above, they are not relevant. //

2024:03:07:02:09:56: Info: Found H.264 encoder: h264_nvenc nvenc: Info: Found HEVC encoder: hevc_nvenc nvenc: Info: Executing [Desktop] [New Thread 0x7fffc8a006c0 (LWP 8161)] [New Thread 0x7fffc3e006c0 (LWP 8162)] [New Thread 0x7fffa98006c0 (LWP 8163)] [New Thread 0x7fffaa2006c0 (LWP 8164)] [New Thread 0x7fffc1c006c0 (LWP 8165)] [New Thread 0x7fffc12006c0 (LWP 8166)] Detaching after fork from child process 8167: Info: CLIENT CONNECTED New Thread 0x7fffabe006c0 (LWP 8168): Info: Screencasting with KMS 2024:03:07:02:09:56: Info: Found monitor for DRM screencasting 2024:03:07:02:09:56: Info: Found connector ID 90: Info: Found cursor plane 38: Warning: Attempting to use NVENC without CUDA support. Reverting back to GPU -> RAM -> GPU 2024:03:07:02:09:56: Info: Found monitor for DRM screencasting 2024:03:07:02:09:56: Info: Found connector ID 90: Info: Found cursor plane 38: Info: SDR color coding Rec. 601: Info: Color depth: 8-bit 2024:03:07:02:09:56: Info: Color range: MPEG: Warning: Client requested reference frame limit, but encoder doesn't support it! [New Thread 0x7fffab4006c0 (LWP 8170)] [New Thread 0x7fffa8e006c0 (LWP 8171)] [New Thread 0x7fff9dc006c0 (LWP 8172)] [New Thread 0x7fff9d2006c0 (LWP 8173)] [New Thread 0x7fff93e006c0 (LWP 8174)]

Thread 74 "sunshine" received signal SIGABRT, Aborted. [Switching to Thread 0x7fffabe006c0 (LWP 8168)] 0x00007ffff5fb332c in ?? () from /usr/lib/libc.so.6 (gdb)

cgutman commented 8 months ago

@nougatbyte can you type bt full at the end when you get that SIGABRT error?

lithces commented 8 months ago

@cgutman I was not able to get the debug info for sunshine. It does downloaded debug symbols for other dependent libraries

However, with root account, I accidentally (no config, tensorflow takes my entire gpu memory leading to cuda error in sunshine) found that for libva it works flawlessly....

nougatbyte commented 8 months ago

@nougatbyte can you type bt full at the end when you get that SIGABRT error?

Sorry missed that part. Here you go: gdb.log

cgutman commented 8 months ago

Okay, that's very helpful. It looks like the crash is occurring in the code where we're blending the cursor into the final image, so it probably has something to do with the cursor image itself.

Despite my best efforts, I am not able to reproduce the issue locally on KDE Plasma 6's Wayland session. I've tried software encoding, hardware encoding, NVIDIA cards, AMD cards, large cursors, small cursors, cursors partially off the screen, increasing DPI scaling, decreasing DPI scaling - nothing seems to trigger this crash.

Can any of you think of anything that might possibly be the missing link here?

Maybe to start, everyone affected please provide:

nougatbyte commented 8 months ago

Kernel: 6.7.8-arch1-1 (64-bit) DE: KDE Plasma 6.0.1, KDE Framwork 6.0.0 Qt Version 6.6.2 GPU: NVIDIA GeForce GTX 980 (Mind that its a chinese manufactured one and it might be a flashed 970) Driver: Proprietary kernel module (nvidia-dkms 550.54.14-4) Monitors: Single Computer is a KVM based virtual machine in proxmox with passed-through GPU via pci-vfio but it is in a Desktop case ^^ Mouse Settings: If it wasnt the default I probably disabled mouse acceleration in KDE System Settings

My Setup is unusual as it is a VM. CPU is set to Host, All CPU Cores are available to the VM. GPU was sold as a GTX 980 but I think its a overclocked 970 (Based on performance and similarly named Bios files)

If it helps I might be able to give you remote control of my VM

cgutman commented 8 months ago

@nougatbyte Okay, I'm curious if there's something strange about the properties set on your cursor plane (that's really the only other idea I have). If possible, please install drm_info-git then trigger the Sunshine crash and without touching the mouse or anything please run sudo drm_info -j > drm.json via SSH and attach the JSON output.

The reason for using SSH is to avoid any action that might change the state of the mouse cursor and affect the results.

nougatbyte commented 8 months ago

drm.json

lithces commented 8 months ago

I am using KDE 5.115.0

For me I am using the Yellow cursor: Oxygen Yellow of size 24. However it works with libva encoder right now.

I will check if software encoder works with the default Breeze Cursors later.

nougatbyte commented 8 months ago

Mine is Breeze Size 24 and the Theme is set to dark mode

cyrilpicard commented 8 months ago

Same issue for me on Gnome/Wayland with software encoding. Works fine with VAAPI encoding (AMD GPU)

Nunardas commented 8 months ago

Hi, same issue with sunshine crashing when using KDE(plasma 6)/Wayland. I was using the version 0.21, I did not have a mouse cursor, so as a work around I added KWIN_FORCE_SW_CURSOR=1 flag to the /etc/environment. file. As far as I know this enables software rendering for the mouse. After updating to v0.22, everything worked, but I decided to to remove the flag because I saw the patch notes for this version and saw (Capture/Linux) Fix missing mouse cursor when using KMS capture on a GPU with hardware cursor support. By removing the flag I stared getting the above error. Hope this helps.

nougatbyte commented 8 months ago

I can confirm that setting KWIN_FORCE_SW_CURSOR=1 also makes it work for me again

cgutman commented 8 months ago

The problem was hiding in plain sight the whole time (except the line number was off by one). And the missing link was ArchLinux itself.

In the last iteration of the copy loop, cursor_end will point to the next entry beyond the cursor data (because std::for_each treats the end range as exclusive). Though it will never actually read data through that pointer, it is technically undefined behavior to even retrieve a reference to it.

Normally, this works fine, however the Arch package compiles with libc++ debug checks enabled (maybe some Arch-specific thing for security reasons?). When we attempt to retrieve that final cursor_end value, the debug checks trigger because the index is outside the valid size.

This is why all my attempts to repro on Fedora and KDE Neon failed - neither of those use the libc++ debug checks.

Here's an Arch build from the PR that should resolve the issue: https://github.com/LizardByte/Sunshine/actions/runs/8210243651/artifacts/1310916259