Repository navigation
Description
Operating System Info
Other
Other OS
NixOS 26.05, KDE Plasma 6.6 (Wayland), PipeWire 1.6.6, NVIDIA 595.71.05 (open), RTX 5090, Ryzen 9 9950X
OBS Studio Version
32.1.2
OBS Studio Version (Other)
nixpkgs build of 32.1.2. The code below is unchanged on master (a8b04ac).
OBS Studio Log URL
https://obsproject.com/logs/5zka0J7GhCMwyOUv (a start that crashed; the log ends after [pipewire] Created registry)
OBS Studio Crash Log URL
None on Linux. Backtrace from systemd-coredump below.
Expected Behavior
OBS starts normally with a "Video Capture Device (PipeWire)" source in the scene collection.
Current Behavior
OBS intermittently crashes with SIGSEGV in the PipeWire thread right after startup (2 of 10 starts on 2026-09-30, two separate cores).
PipeWire loop thread (crashed):
#0 on_registry_global_cb (linux-pipewire.so + 0x1e90a)
#1 registry_demarshal_global (libpipewire-module-protocol-native.so)
#2 process_remote (libpipewire-module-protocol-native.so)
#3 on_remote_data (libpipewire-module-protocol-native.so)
#4 loop_iterate (libspa-support.so)
#5 do_loop (libpipewire-0.3.so.0)
Main thread:
#0 __lll_lock_wait (libc.so.6)
#1 pthread_mutex_lock (libc.so.6)
#2 loop_lock (libspa-support.so)
#3 pw_thread_loop_lock (libpipewire-0.3.so.0)
#4 on_pipewire_remote_opened_cb (linux-pipewire.so)
#5 g_task_return_now (libgio-2.0.so.0)
gdb on both cores shows the same fault: mov 0x60(%rax),%rax at on_registry_global_cb+106 with rax = 0 and si_addr = 0x60. 0x60 is the offset of registry in struct _obs_pipewire, so this is obs_pipewire_get_registry(NULL).
The race:
on_pipewire_remote_opened_cbstores the connection only afterobs_pipewire_connect_fd()returns:obs-studio/plugins/linux-pipewire/camera-portal.c
Line 1075 in a8b04ac
connection->obs_pw = obs_pipewire_connect_fd(pipewire_fd, ®istry_events, connection); obs_pipewire_connect_fd()adds the registry listener and unlocks the thread loop before it returns:obs-studio/plugins/linux-pipewire/pipewire.c
Lines 1152 to 1156 in a8b04ac
pw_registry_add_listener(obs_pw->registry, &obs_pw->registry_listener, registry_events, user_data); blog(LOG_INFO, "[pipewire] Created registry %p", obs_pw->registry); } pw_thread_loop_unlock(obs_pw->thread_loop); - In that window the PipeWire thread can dispatch
registry.global, andon_registry_global_cbreadsconnection->obs_pwwhile it is still NULL:registry = obs_pipewire_get_registry(connection->obs_pw);
Steps to Reproduce
- Use a scene collection that contains a "Video Capture Device (PipeWire)" source.
- Start OBS repeatedly.
- Some starts crash right after
[camera-portal] Successfully accessed cameras/[pipewire] Created registry.
Anything else we should know?
A possible fix is to store the pointer before the loop is unlocked (for example via an out-parameter of obs_pipewire_connect_fd()), or to add the registry listener in a separate step after connection->obs_pw is assigned, under pw_thread_loop_lock. The race only exists while a PipeWire camera source is loaded.
Activity
Fenrirthviti commentedon Oct 1, 2026
Was this proposed fix tested?
TheMorpheus407 commentedon Oct 1, 2026
Not when I filed this, I only had the two cores and the code. I've tested it now.
Setup: OBS 32.1.2 built from source with and without the patch below (only
obs-studiorebuilt, same dependencies), separate config dir, one "Video Capture Device (PipeWire)" source, OBS started under gdb and quit once[camera-portal] Found deviceis logged. To make the race reproducible, an LD_PRELOAD shim sleeps 50 ms after everypw_thread_loop_unlock()on the main thread, which widens the window between the unlock inobs_pipewire_connect_fd()and the assignment inon_pipewire_remote_opened_cb().on_registry_global_cbwithrax = 0(same fault as the original cores)The patch registers the camera portal's registry listener in a new helper after
connection->obs_pwhas been assigned.obs_pipewire_connect_fd()itself is unchanged. With this, no caller passes registry events to it anymore, so that parameter could be dropped in a follow-up. It applies cleanly to a8b04ac.Happy to open a PR if that's easier for you.
Fenrirthviti commentedon Oct 1, 2026
This is giving all the hallmarks of an AI-generated report. Was AI used to write this?
TheMorpheus407 commentedon Oct 1, 2026
Yes, I do let ai write together, what I found in my logs and tested, so you get it sorted properly and not my chaos writing. If that's not desired you can close the commit and tell me, Ill know for next time
Fenrirthviti commentedon Oct 1, 2026
Per our contribution guidelines we do not accept AI-generated content in our community.