Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background Game Recording while in gamescope-session often crashes the client after quitting games #11498

Closed
matte-schwartz opened this issue Nov 20, 2024 · 9 comments

Comments

@matte-schwartz
Copy link

Your system information

  • Steam client version (build number or date): 1731990050
  • Distribution (e.g. Ubuntu): Arch Linux, Fedora, SteamOS
  • Opted into Steam client beta?: Yes
  • Have you checked for system updates?: Yes
  • Steam Logs: steam-logs.tar.gz (from ROG Ally, Arch Linux)
  • GPU: AMD Z1 Extreme, AMD Vangogh APU

Please describe your issue in as much detail as possible:

When Game Recording in the background is enabled within the Steam client, and gamescope-session is in use, quitting games will often lead to an apparent driver deadlock that restarts the Steam client. So far, I've had it happen twice on SteamOS Main on my Steam Deck OLED, and then it happens far more frequently on my ROG Ally currently running CachyOS (Arch Linux).

[2024-11-20 08:49:05] Encoding complete
[2024-11-20 08:49:05] *** pw_stream_destroy called from wrong context, check thread and locking: Operation not permitted
[2024-11-20 08:49:05] *** impl_ext_end_proxy called from wrong context, check thread and locking: Operation not permitted
[2024-11-20 08:49:05] 'this->recurse > 0' failed at ../pipewire/src/pipewire/thread-loop.c:62 do_unlock()
[2024-11-20 08:49:05] CDesktopCapturePipeWire: PipeWire stream state changed to paused
[2024-11-20 08:49:05] CDesktopCapturePipeWire: PipeWire stream state changed to unconnected
[2024-11-20 08:49:15] Driver deadlock in hardware accelerated desktop capture, aborting
[2024-11-20 08:49:15] src/steamUI/gamestream/desktopstreamthread.cpp (148) : Driver deadlock in hardware accelerated desktop capture, aborting
[2024-11-20 08:49:15] src/steamUI/gamestream/desktopstreamthread.cpp (148) : Driver deadlock in hardware accelerated desktop capture, aborting
[2024-11-20 08:49:15] src/steamUI/gamestream/desktopstreamthread.cpp (148) : Fatal assert; application exiting
[2024-11-20 08:49:15] src/steamUI/gamestream/desktopstreamthread.cpp (148) : Fatal assert; application exiting
[2024-11-20 08:49:15] 11/20 08:49:15 Init: Installing breakpad exception handler for appid(steam)/version(1731990050)/tid(1567)
[2024-11-20 08:49:15] assert_20241120084915_86.dmp[4904]: Uploading dump (out-of-process)
[2024-11-20 08:49:15] /tmp/dumps/assert_20241120084915_86.dmp
[2024-11-20 08:49:16] assert_20241120084915_86.dmp[4904]: Finished uploading minidump (out-of-process): success = yes
[2024-11-20 08:49:16] assert_20241120084915_86.dmp[4904]: response: CrashID=bp-495d9995-2eb3-4503-a8ea-ee9122241120
[2024-11-20 08:49:16] assert_20241120084915_86.dmp[4904]: file ''/tmp/dumps/assert_20241120084915_86.dmp'', upload yes: ''CrashID=bp-495d9995-2eb3-4503-a8ea-ee9122241120''

The ROG Ally runs a much newer Mesa than SteamOS, but other than that I tested the same exact gamescope and Steam client versions across both devices. I've also seen reports from elsewhere about this issue on non-SteamOS distros: ublue-os/bazzite#1862. When I did experience the same Steam crash on SteamOS Main, console output looked identical to the logging above.

Steps for reproducing this issue:

  1. Start running a game (I chose Hades II)
  2. Let the game play for ~30 seconds or so
  3. Exit the game by using the left-side Steam menu
@matte-schwartz
Copy link
Author

Seems to happen to me 100% of the time on SteamOS staging, maybe some other package version that hasn't made it to Stable/Preview/Main yet that's present on staging and upstream Arch.

Can rule out Mesa since downgrading to SteamOS' Mesa version makes no difference.

@matte-schwartz
Copy link
Author

matte-schwartz commented Nov 21, 2024

I seem to be able to avoid a full Steam client crash even with the driver deadlock warning if I add -debug_steamapi to my Steam launch options. I also added LIBVA_MESSAGING_LEVEL=2 and LIBVA_TRACE=/tmp/libva
to /etc/libva.conf

logs with debugging verbosity + `-debug_steamapi`
GameAction [AppID 1145350, ActionID 1] : LaunchApp changed task to Completed with ""
[gamescope] [Error] pipewire: push_pipewire_buffer: Already had a buffer?!: Resource temporarily unavailable
[gamescope] [Error] pipewire: push_pipewire_buffer: Already had a buffer?!: Resource temporarily unavailable
>>> Switching video stream from NONE to Desktop_MovieStream
[gamescope] [Error] pipewire: push_pipewire_buffer: Already had a buffer?!: Resource temporarily unavailable
Adding process 17586 for gameID 1145350
Refreshing process list for game 1145350
2 game pids rooted at pid 17581:
- 17581,17586
GameScope focus changed to Steam
CDesktopCapturePipeWire: updating capture appid: 1145350
CDesktopCapturePipeWire: setting gamescope focus appid: 1145350
CDesktopCapturePipeWire: setting gamescope focus appid: 1145350
CDesktopCapturePipeWire: setting gamescope focus appid: 1145350
CDesktopCapturePipeWire: setting gamescope focus appid: 1145350
CDesktopCapturePipeWire: setting gamescope focus appid: 1145350
CDesktopCapturePipeWire: setting gamescope focus appid: 1145350
CDesktopCapturePipeWire: setting gamescope focus appid: 1145350
CDesktopCapturePipeWire: setting gamescope focus appid: 1145350
CDesktopCapturePipeWire: setting gamescope focus appid: 1145350
CDesktopCapturePipeWire: PipeWire stream state changed to paused
[gamescope] [Info]  pipewire: stream state changed: paused
Building new pipeline
Trying to create an encoder for recording: [hardware_enabled=true][hardware_suppressed=false]
Allowed Codecs: 4
Failed to load optional module libnvidia-encode.so.1
Failed to load optional module libamfrt32.so.1
Created encoder VAAPI for codec 4
CDesktopCapturePipeWire: PipeWire stream format changed (size: 7680x2160, format 23, stride 7680, size 24883200, dmabuf: 0)
CDesktopCapturePipeWire: PipeWire stream format changed (size: 3840x1080, format 23, stride 3840, size 6220800, dmabuf: 0)
CGameStreamVideoStageVAAPI: Reinitializing 3840x1080 at 12000 Kbit/s and 60.00 FPS with quality 1
CDesktopCapturePipeWire: PipeWire stream state changed to streaming
[gamescope] [Info]  pipewire: stream state changed: streaming
[gamescope] [Info]  xwm: Exposing appid 1145350 (1145350 32-bit) focus-wise on pipewire stream.
Video Encoder Changed
>>> Saw first frame, starting a session
Adding process 17587 for gameID 1145350
Refreshing process list for game 1145350
3 game pids rooted at pid 17581:
- 17581,17586,17587
Game Recording - Recording Started [recording=bg_1145350_20241121_185304]
GameScope focus changed to Steam
>>> Recording new resolution 3840x1080 using bitrate 12000kbps
>>> Capture method set to Desktop PipeWire NV12 + VAAPI H264
>>> First video pts is 724.604747s, first video PTS is 0.033333s
...
src/steamUI/gamestream/desktopstreamthread.cpp (148) : Driver deadlock in hardware accelerated desktop capture, aborting
src/steamUI/gamestream/desktopstreamthread.cpp (148) : Driver deadlock in hardware accelerated desktop capture, aborting
src/steamUI/gamestream/desktopstreamthread.cpp (148) : Driver deadlock in hardware accelerated desktop capture, aborting
11/21 10:53:39 Init: Installing breakpad exception handler for appid(steam)/version(1732151988)/tid(15981)
assert_20241121105339_46.dmp[19554]: Uploading dump (out-of-process)
/tmp/dumps/assert_20241121105339_46.dmp
>>> Stopped desktop stream
PulseAudio: Context connection terminated
Game Recording - Recording Stopped [recording=bg_1145350_20241121_185304]
Stopped game recording session
------------------------------------------------------------------------------------------------------
Game Recording - game stopped [gameid=1145350]

@lostgoat
Copy link
Contributor

Thanks for the report. There’s a fix queued up on the client side. It won’t be directly on the next beta, but probably the one after that.

@flibitijibibo
Copy link

This is also reproducible when running Steam with game recording off, but remote play enabled, since it seems to use the same system - repro steps are thankfully simple:

  • Launch Steam in gamescope (can be nested or embedded)
  • Disable recording (restart if needed?)
  • Start a remote play session with any Steam Link client, don't need to start any games
  • Stop streaming, wait a few seconds for the deadlock to hit
Click'em
=====================================================================
Game: UNKNOWN (0)
Setting target bitrate to 100000 Kbit/s, burst bitrate is 500000 Kbit/s
Creating new encoder for codec 3
Encoder init succeeded, now have 1 encoder(s)
Desktop state changed: desktop: { pos:    0,   0 size: 3840,2160 } primary: { pos:    0,   0 size: 3840,2160 }
Desktop state changed: desktop: { pos:    0,   0 size: 3840,2160 } primary: { pos:    0,   0 size: 3840,2160 }
Caching cursor image for se-resize, size 64x64, serial 40, cache size = 1
GameScope focus changed to Steam
Window title set to Steam Big Picture Mode
Changing record window: 0x1a00030 (27263024)
>>> Starting desktop stream
SynchronizeClientState(): setting capture size 3840x2160
SynchronizeClientState(): setting title to Steam Big Picture Mode
SynchronizeClientState(): setting icon 128x128
SynchronizeClientState(): setting cursor to 40
SynchronizeClientState(): setting activity to k_EStreamActivityDesktop: Steam Controller Configs - Desktop
Recording system audio
PulseAudio: Sink alsa_output.usb-Generic_USB_Audio-00.HiFi__Speaker__sink is default
PulseAudio: Adding sink[58] alsa_output.usb-Generic_USB_Audio-00.HiFi__SPDIF__sink with priority 1, monitor is alsa_output.usb-Generic_USB_Audio-00.HiFi__SPDIF__sink.monitor
PulseAudio: Adding sink[59] alsa_output.usb-Generic_USB_Audio-00.HiFi__Headphones__sink with priority 1, monitor is alsa_output.usb-Generic_USB_Audio-00.HiFi__Headphones__sink.monitor
PulseAudio: Adding sink[60] alsa_output.usb-Generic_USB_Audio-00.HiFi__Speaker__sink with priority 3, monitor is alsa_output.usb-Generic_USB_Audio-00.HiFi__Speaker__sink.monitor
PulseAudio: Adding sink[859] alsa_output.pci-0000_03_00.1.hdmi-stereo with priority 1, monitor is alsa_output.pci-0000_03_00.1.hdmi-stereo.monitor
PulseAudio: Recording on device alsa_output.usb-Generic_USB_Audio-00.HiFi__Speaker__sink.monitor
CDesktopCapturePipeWire: PipeWire stream state changed to connecting
CDesktopCapturePipeWire: PipeWire stream state changed to paused
PulseAudio: Connected to device alsa_output.usb-Generic_USB_Audio-00.HiFi__Speaker__sink.monitor (60, not suspended).
PulseAudio: Using sample spec 's16le 2ch 48000Hz', channel map 'front-left,front-right'.
CDesktopCapturePipeWire: PipeWire stream format changed (size: 3840x2160, format 23, stride 3840, size 12441600, dmabuf: 0)
CDesktopCapturePipeWire: PipeWire stream state changed to streaming
[gamescope] [Info]  pipewire: stream state changed: streaming
[gamescope] [Error] pipewire: push_pipewire_buffer: Already had a buffer?!: Resource temporarily unavailable
>>> Switching video stream from NONE to Desktop_MovieStream
[gamescope] [Error] pipewire: push_pipewire_buffer: Already had a buffer?!: Resource temporarily unavailable
BuildCompleteAppOverviewChange: 1247 apps
CDesktopCapturePipeWire: PipeWire stream state changed to paused
[gamescope] [Info]  pipewire: stream state changed: paused
[gamescope] [Error] pipewire: push_pipewire_buffer: Already had a buffer?!: Resource temporarily unavailable
CLIENT: Got control packet k_EStreamControlSetQoS
CLIENT: Got control packet k_EStreamControlSetTargetBitrate
CLIENT: Starting audio stream: frequency=48000, channels=2
CLIENT: Opened audio device: format=2, channels=2, frequency=48000
CLIENT: Initialized audio decoder: codec=3, sample rate=48000, channels=2
CLIENT: Got control packet k_EStreamControlStartAudioData
CLIENT: Got control packet k_EStreamControlSetSpectatorMode
CLIENT: Got control packet k_EStreamControlSetCaptureSize
CLIENT: Got control packet k_EStreamControlSetTitle
CLIENT: Got control packet k_EStreamControlSetIcon
CLIENT: Got control packet k_EStreamControlSetCursor
CLIENT: Got control packet k_EStreamControlSetActivity
Building new pipeline
Trying to create an encoder for streaming: [hardware_enabled=true][hardware_suppressed=false]
Allowed Codecs: 5,4
CDesktopCapturePipeWire: PipeWire stream format changed (size: 3840x2160, format 23, stride 3840, size 12441600, dmabuf: 0)
CDesktopCapturePipeWire: PipeWire stream format changed (size: 1920x1080, format 23, stride 1920, size 3110400, dmabuf: 0)
Created encoder VAAPI for codec 5
CGameStreamVideoStageVAAPI: Reinitializing 1920x1080 at 15000 Kbit/s and 59.75 FPS with quality 0
CDesktopCapturePipeWire: PipeWire stream state changed to streaming
[gamescope] [Info]  pipewire: stream state changed: streaming
ffmpeg verbose: libva: VA-API version 1.22.0
ffmpeg verbose: libva: Trying to open /usr/lib/dri-nonfree/radeonsi_drv_video.so
ffmpeg verbose: libva: Trying to open /usr/lib/dri-freeworld/radeonsi_drv_video.so
ffmpeg verbose: libva: Found init function __vaDriverInit_1_22
ffmpeg verbose: libva: va_openDriver() returns 0
ffmpeg verbose: Initialised VAAPI connection: version 1.22
ffmpeg verbose: VAAPI driver: Mesa Gallium driver 24.2.8 for AMD Radeon RX 7900 XTX (radeonsi, navi31, LLVM 19.1.0, DRM 3.59, 6.11.10-302.fc41.x86_64).
ffmpeg verbose: Driver not found in known nonstandard list, using standard behaviour.
ffmpeg verbose: Input surface format is nv12.
ffmpeg verbose: Using VAAPI profile VAProfileHEVCMain (17).
ffmpeg verbose: Using VAAPI entrypoint VAEntrypointEncSlice (6).
ffmpeg verbose: Using VAAPI render target format YUV420 (0x1).
ffmpeg verbose: Using CTU size 32x32, min CB size 16x16.
ffmpeg verbose: RC mode: VBR.
ffmpeg verbose: Block Level bitrate control: OFF.
ffmpeg verbose: RC target: 83% of 18000000 bps over 1000 ms.
ffmpeg verbose: RC buffer: 18000000 bits, initial fullness 13500000 bits.
ffmpeg verbose: RC framerate: 239/4 (59.75 fps).
ffmpeg verbose: Using intra and P-frames (supported references: 1 / 0).
ffmpeg warning: Driver does not support some wanted packed headers (wanted 0xd, found 0x1).
ffmpeg verbose: Using level 4.1.
Video Encoder Changed
>>> Capture method set to Desktop PipeWire NV12 + VAAPI HEVC
>>> Capture resolution set to 1920x1080
>>> Capture colorspace set to BT.601 limited range
CDesktopCapturePipeWire: PipeWire stream state changed to paused
[gamescope] [Info]  pipewire: stream state changed: paused
CDesktopCapturePipeWire: PipeWire stream format changed (size: 1920x1080, format 23, stride 1920, size 3110400, dmabuf: 1)
dynamicbitrate: link 14.977757 Mbit/s lp 100.000000 Mbit/s meas 26.550030 Mbit/s pflags 0 1
CDesktopCapturePipeWire: PipeWire stream state changed to streaming
[gamescope] [Info]  pipewire: stream state changed: streaming
>>> Capture method set to Desktop PipeWire NV12 DMABUF + VAAPI HEVC
CLIENT: Queued 113.333 ms, clearing audio stream
>>> Client video decoder set to iOS Metal hardware decoding
CLIENT: Got control packet k_EStreamControlSetCursorImage
CLIENT: iOS Metal hardware decoding
CLIENT: Got control packet k_EStreamControlStartVideoData
CLIENT: Got control packet k_EStreamControlVideoEncoderInfo
CLIENT: Got control packet k_EStreamControlSetCursorScale
CLIENT: Got control packet k_EStreamControlVideoEncoderInfo
CLIENT: Color matrix = ITU_R_601_4
CLIENT: Video range = limited
CLIENT: Got control packet k_EStreamControlControllerConfigMsg
CLIENT: Got control packet k_EStreamControlControllerConfigMsg
CLIENT: Got control packet k_EStreamControlControllerConfigMsg
CGameStreamVideoStageVAAPI: Reinitializing 1920x1080 at 19236 Kbit/s and 59.75 FPS with quality 0
ffmpeg verbose: libva: VA-API version 1.22.0
ffmpeg verbose: libva: Trying to open /usr/lib/dri-nonfree/radeonsi_drv_video.so
ffmpeg verbose: libva: Trying to open /usr/lib/dri-freeworld/radeonsi_drv_video.so
ffmpeg verbose: libva: Found init function __vaDriverInit_1_22
ffmpeg verbose: libva: va_openDriver() returns 0
ffmpeg verbose: Initialised VAAPI connection: version 1.22
ffmpeg verbose: VAAPI driver: Mesa Gallium driver 24.2.8 for AMD Radeon RX 7900 XTX (radeonsi, navi31, LLVM 19.1.0, DRM 3.59, 6.11.10-302.fc41.x86_64).
ffmpeg verbose: Driver not found in known nonstandard list, using standard behaviour.
ffmpeg verbose: Input surface format is nv12.
ffmpeg verbose: Using VAAPI profile VAProfileHEVCMain (17).
ffmpeg verbose: Using VAAPI entrypoint VAEntrypointEncSlice (6).
ffmpeg verbose: Using VAAPI render target format YUV420 (0x1).
ffmpeg verbose: Using CTU size 32x32, min CB size 16x16.
ffmpeg verbose: RC mode: VBR.
ffmpeg verbose: Block Level bitrate control: OFF.
ffmpeg verbose: RC target: 83% of 23083200 bps over 1000 ms.
ffmpeg verbose: RC buffer: 23083200 bits, initial fullness 17312400 bits.
ffmpeg verbose: RC framerate: 239/4 (59.75 fps).
ffmpeg verbose: Using intra and P-frames (supported references: 1 / 0).
ffmpeg warning: Driver does not support some wanted packed headers (wanted 0xd, found 0x1).
ffmpeg verbose: Using level 4.1.
Video Encoder Changed
CLIENT: Got control packet k_EStreamControlControllerConfigMsg
CLIENT: Got control packet k_EStreamControlControllerPersonalizationUpdate
CLIENT: Got control packet k_EStreamControlTouchConfigActive
CLIENT: Got control packet k_EStreamControlTouchConfigActive
CLIENT: Got control packet k_EStreamControlTouchActionSetActive
CLIENT: Got control packet k_EStreamControlControllerConfigMsg
CLIENT: Got control packet k_EStreamControlTouchConfigActive
CLIENT: Texture rect: 812x375 at 0,0
CLIENT: Video rect: 2434x1124 at 0,0
CLIENT: Warning: Couldn't find actionset 0 in config for app 769, defaulting to the first one
CLIENT: Got control packet k_EStreamControlSetTouchConfigData
CLIENT: Ignoring duplicate controller configuration for 769, revision 22
CLIENT: Got control packet k_EStreamControlSetTouchConfigData
CLIENT: Ignoring duplicate controller configuration for 769, revision 22
CLIENT: Got control packet k_EStreamControlSetTouchConfigData
CLIENT: Texture rect: 1920x1080 at 0,0
CLIENT: Video rect: 2434x1124 at 0,0
CLIENT: Video size: 1920x1080, output size: 2436x1125, overlay size: 2436x1125
CLIENT: Texture rect: 1920x1080 at 0,0
CLIENT: Video rect: 1998x1124 at 220,0
CLIENT: Texture rect: 1920x1080 at 0,0
CLIENT: Video rect: 1998x1124 at 220,0
CLIENT: Texture rect: 1920x1080 at 0,0
CLIENT: Video rect: 1998x1124 at 220,0
Encoding complete
*** pw_stream_destroy called from wrong context, check thread and locking: Operation not permitted
*** impl_ext_end_proxy called from wrong context, check thread and locking: Operation not permitted
'this->recurse > 0' failed at ../src/pipewire/thread-loop.c:62 do_unlock()
CDesktopCapturePipeWire: PipeWire stream state changed to paused
CDesktopCapturePipeWire: PipeWire stream state changed to unconnected
[gamescope] [Info]  pipewire: stream state changed: paused
Driver deadlock in hardware accelerated desktop capture, aborting
src/steamUI/gamestream/desktopstreamthread.cpp (148) : Driver deadlock in hardware accelerated desktop capture, aborting
src/steamUI/gamestream/desktopstreamthread.cpp (148) : Driver deadlock in hardware accelerated desktop capture, aborting
src/steamUI/gamestream/desktopstreamthread.cpp (148) : Fatal assert; application exiting
src/steamUI/gamestream/desktopstreamthread.cpp (148) : Fatal assert; application exiting
12/06 12:33:56 Init: Installing breakpad exception handler for appid(steam)/version(1733265492)/tid(28519)
assert_20241206123356_46.dmp[29244]: Uploading dump (out-of-process)
/tmp/dumps/assert_20241206123356_46.dmp
[gamescope] [Info]  launch: Primary child shut down!
(EE)(EE)  failed to read Wayland events: Broken pipe
failed to read Wayland events: Broken pipe

@matte-schwartz
Copy link
Author

The driver deadlock I reported seems fixed with:
Fixed potential crash when exiting a game if Game Recording is enabled on systems with recent versions of pipewire.

@isaboll1
Copy link

The deadlock seems fixed, although I found no recording is created once you go and save it

@isaboll1
Copy link

So with Stable, the manual recording causes a crash/restart with the driver deadlock, yet the clip is still saved from before the crash, while now in the Beta there is no more crash from a driver deadlock, but there is no clip created or saved

@flibitijibibo
Copy link

Not sure about recording, but can confirm latest beta fixes the issue for Remote Play capture.

@matte-schwartz
Copy link
Author

closing then as both issues found here have been addressed. no recording being created should probably be its own issue, if it is not already one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants