Skip to content

Quitting the GUI does not end the process on Linux #3739

Open

Description

@alerque

Working with 1.0.0.r148.g7a29f9 as of this morning I can confirm that opening OBS after a clean boot into any scene configuration, then quitting it leaves behind a obs-studio-rust-gui process (and some subprocesses if there were any sources in the scene) that does not die. I do not have the tray icon enabled (although I tried it with that enabled too). Launching again always says there is a running process. The process does not even respond to a SIGHUP. I can only make it go away with SIGKILL, at which point launching prompts for normal vs. safe mode.

Originally posted by @alerque in #3710

Activity

  1. vpacher commented on Nov 6, 2026

    @vpacher
    Member

    Claiming: investigation.

    One case that reproduces here: a source-record filter whose output never started (its source delivered no audio) makes obs_output_destroy() wait forever at shutdown, so the process stays. Upstream 33.0.1 quit cleanly in the same test. This may be connected to #3747 and #3742.

    Plan: check whether that is the case here, and reproduce a quit with a scene collection without source-record filters.

  2. vpacher commented on Nov 6, 2026

    @vpacher
    Member

    Blocked: waiting on #3747. The hang I can reproduce comes from a source-record output that never started, which #3747 can cause. I will test the quit again with the #3747 fix, and with a scene collection without source-record filters.

  3. vpacher commented on Nov 6, 2026

    @vpacher
    Member

    /ready

    The cause is known: the FFmpeg muxer output ends a stop only on a packet, so an output that never got one (Source Record on a source whose audio has not started) never finishes stopping, and OBS waits on it at exit. Upstream 33.0.1 does the same.

  4. added
    readyMeets the definition of Ready; claimable
    and removed
    needs-investigationUnderdefined: research before it can be Ready
    on Nov 6, 2026
  5. vpacher commented on Nov 6, 2026

    @vpacher
    Member

    Claiming: #3739

    1. libobs: End the stop of an output that never got a packet #3764: libobs ends the stop of an encoded output that never got a packet; the FFmpeg muxer closes the old pipe on its next start. Open now, gate-stamped.
  6. vpacher commented on Nov 6, 2026

    @vpacher
    Member

    Fixed by #3764 (merged 2026-11-06). libobs now ends the stop of an encoded output that never got a packet, and the FFmpeg muxer closes the old pipe on its next start. OBS quits normally when a Source Record recording never started; before, it hung at exit.

    Checked on Linux with DistroAV 6.2.2 and Source Record 0.4.8: quitting hung in every run where Source Record had not started (master and upstream 33.0.1); with the fix, 0 of 6 runs hung.

    Left open: Source Record on an NDI source with a still picture (NDI Test Patterns) often does not start at all, on our build and on upstream 33.0.1. That is a separate question and is part of #3742.

  7. 9 remaining items

  8. alerque commented on Nov 7, 2026

    @alerque
    Author

    If I activate a scene collection with a single scene and no sources at all, then quit, kill all the hung processes, then re-open and quit again it still hangs the GUI process, but in that case there are no browser or muxer processes, just the gui that is hung.

    I can also replicate both muxer and browser processes hanging along with the GUI, but they don't seem to be the root culprit here.

  9. vpacher commented on Nov 7, 2026

    @vpacher
    Member

    Thanks, that is a big step: if an empty scene collection hangs too, the sources and the muxer are not the cause, only side effects.

    Was there a change to whether having active NDI outputs counts as "streaming"?

    No. Source Record asks the frontend (obs_frontend_streaming_active() and obs_frontend_recording_active()), and those report only OBS's own stream and recording. NDI outputs do not count, and that has not changed.

    What I tested here, all quit in under 2 s: an empty collection with the NDI main and preview outputs on and a receiver connected, a collection with a reachable source, and a quit while an MKV main recording runs. So something else in your setup makes the difference: a plugin, a profile setting, a script or a websocket client. Two things from the next hang would show which:

    1. The OBS log of that session (~/.config/obs-studio-rust/logs/, the newest file). It lists every loaded plugin, and its last lines show at which step the shutdown stops.
    2. The stacks of the hung process:
    gdb -p "$(pgrep -o obs-studio-rust-gui)" -batch -ex 'thread apply all bt' > obs-hang-stacks.txt 2>&1

    The log probably has no secrets, but check it before you post it: it can contain paths and service names.

  10. alerque commented on Nov 7, 2026

    @alerque
    Author

    Attached is a log from opening a blank scene and trying to quit.

    2026-11-08 00-24-11.txt

    Meanwhile I'll note you shouldn't blindly trust LLM output like you are: pgrep -o won't work for that. Obviously you didn't try it yourself.

  11. vpacher commented on Nov 7, 2026

    @vpacher
    Member

    Sorry, I posted the wrong one; it has been a long day on your issues. This is the right one:

    sudo gdb -p "$(pidof obs-studio-rust-gui)" -batch -ex 'thread apply all bt' > obs-hang-stacks.txt 2>&1

    Thanks for the log, it helps a lot. It ends normally: "Number of memory leaks: 0" is the last thing OBS prints after its shutdown has finished. So OBS, its outputs and its modules all shut down, and the process hangs after that, while it exits (library destructors and exit handlers). That is a different kind of hang from the two fixed this week.

    Your log also shows plugins I do not have in my test setup: Advanced Scene Switcher 1.37.0 with its OpenCV, speech, MIDI, MQTT, USB and Stream Deck parts, obs-ptz, obs-webrtc, obs-vst and linux-jack. Several of these start their own threads, and one that is still running can keep the process from exiting.

    Two quick checks with the empty collection:

    1. Disable Advanced Scene Switcher (Tools, Plugin Manager), restart OBS and quit. If it exits, enable it again and disable obs-ptz instead.
    2. If it still hangs, the stacks from the command above show which library the exit waits in.
  12. vpacher commented on Nov 7, 2026

    @vpacher
    Member

    A short update: #3933 is fixed on master (#3935). It was another shutdown hang inherited from upstream OBS: a stream that is stopped while it waits to reconnect (for example a Source Record stream to an SRT server that does not answer) kept OBS from exiting. It is not your bug, because your log shows OBS's shutdown finishing. Your case is still open here, and the Plugin Manager check or the stacks will tell us more.

  13. alerque commented on Nov 8, 2026

    @alerque
    Author

    Advanced Scene Switcher seems to be at least one culprit of shutdown hangs, even when it is marked as inactive (as opposed to active where it is listening to events to trigger actions). There may be others too since I only tested a blank scene and no browser or NDI sources which seem to have their own trouble since they end with different subprocesses hung.

  14. vpacher commented on Nov 8, 2026

    @vpacher
    Member

    Thanks, that was the pointer we needed. I reproduced it on Arch with Advanced Scene Switcher 1.37.0 (your commit, e136086) and a blank scene: OBS hangs at exit every time. The hang is in the scene switcher's MIDI sub-plugin, in libremidi's PipeWire backend:

    exit()
     -> ~vector<libremidi::observer>   (advss::setupMidiDeviceObservers()::observers, a static)
     -> libremidi::observer_pipewire::~observer_pipewire   (observer.hpp:58)
     -> std::thread::join()
          poll thread: libremidi::pipewire_helpers::run_poll_loop   (helpers.hpp:171)
                       -> pw_loop_iterate -> pthread_mutex_lock   (never returns)
    

    Same plugin commit, only the MIDI sub-plugin changed, blank scene, two quits each:

    advanced-scene-switcher-midi.so Quit
    built with libremidi 4.5.0 hangs
    built with libremidi 4.3.0 (the submodule pin; no PipeWire backend) 0.2 s
    removed 0.2 s

    This is why it worked before: the AUR package switched to the system libremidi 4.5.0 with the PipeWire backend on 10-29. Before that, it built the pinned 4.3.0. The current AUR package (1.37.2) pins the same libremidi 4.5.0, so I expect that an update does not fix it.

    If you do not use MIDI conditions, move /usr/lib/obs-plugins/advanced-scene-switcher-plugins/advanced-scene-switcher-midi.so out of that folder. OBS should then quit normally. Can you confirm that on your machine?

    The browser and NDI subprocess hangs are probably separate. If one still shows up after this, please open a new issue with its stacks.

  15. removed
    readyMeets the definition of Ready; claimable
    on Nov 10, 2026
  16. zackees commented on Nov 10, 2026

    @zackees
    Member

    Cleanup: keeping this open and removing ready pending the upstream/plugin and reporting-desktop verification. The latest investigation isolates Advanced Scene Switcher 1.37.0's MIDI plugin with libremidi 4.5.0: its PipeWire observer destructor joins a stuck poll thread; the same plugin with pinned libremidi 4.3.0 or with MIDI removed exits in 0.2 s. That comment still asks the reporter to confirm the workaround. #4309 subsequently merged as b0fd50e (verified ancestor of origin/master 45dc048), providing a post-shutdown exit watchdog, not a repair of libremidi's destructor. Its real-app experiment used macOS and a synthetic blocking plugin, not this Arch installation. Still required: confirm behavior on the reporter's current OBS/Advanced Scene Switcher/libremidi combination, fix or avoid the upstream PipeWire destructor hang, and collect separate stacks/issues for any remaining browser/NDI subprocess hangs. Linux can investigate this Linux bug, but this slot lacks the reporter's Arch/plugin environment; it cannot establish that desktop acceptance from merged watchdog tests alone. No fresh desktop reproduction or upstream fix is claimed here.

  17. alerque commented on Nov 12, 2026

    @alerque
    Author

    A mixed bag here, and I need to do more local testing but am out of time with the relevant equipment.

    The most pernicious blocker is indeed related to this:

    If you do not use MIDI conditions, move /usr/lib/obs-plugins/advanced-scene-switcher-plugins/advanced-scene-switcher-midi.so out of that folder. OBS should then quit normally. Can you confirm that on your machine?

    Removing the midi module from the system does let OBS exit cleanly. Of course then the plugin doesn't work right either.

    I'm not clear from the above diagnostics whether I should be reporting this upstream to the plugin author in regard to Arch's pipewire version or if this is something OBS itself needs to work around. This does reproduce on the current upstream OBS release, but if it is something OBS can fix and not the plugin then it should be addressed here. If it is an upstream bug that's fine, but the above diagnostics seem to go back and forth on that point. The watchdog definitely helps pragmatically, but right now I'm basically stuck with it handing on every exit.

    Also I have at least one OTHER shutdown hangup that occurs even without the ASS plugin, and I think it is related to NDI monitoring of scenes. I haven't isolated it yet though, but I don't really consider this fully resolved, only partially mitigated.

  18. vpacher commented on Nov 13, 2026

    @vpacher
    Member

    Thanks for confirming. To answer the question: this is an upstream bug, not one OBS can fix.

    The hang is in Advanced Scene Switcher's MIDI plug-in, in code that runs after OBS has shut down. The plug-in keeps its libremidi MIDI device observers in a static object. When the process exits, that object is destroyed, and libremidi's PipeWire observer waits for its own polling thread to stop. That thread is stuck in PipeWire, so the wait never ends. OBS does not call or own this code, which is why upstream OBS hangs the same way.

    There are two places where it can be fixed:

    • libremidi: the PipeWire observer should not block forever in its destructor. Your system has libremidi 4.5.0; the current release is 5.4.3, so it may already behave differently there, but I have not tested that.
    • Advanced Scene Switcher: if the plug-in stopped its MIDI observers when OBS unloads it (obs_module_unload), instead of leaving them to the static destructor at process exit, the observer would be destroyed while PipeWire still runs normally. This is my reading of the stacks, not tested.

    I can write the upstream reports with the stacks and the reproduction (a blank scene, Advanced Scene Switcher 1.37 with libremidi 4.5.0). Would you prefer to file them yourself, since it is your setup, or should I?

    About the watchdog: with a build from this week, OBS should end itself 10 s after the window closes, and write a line like this at the end of the log:

    exit-watchdog: exit did not finish in 10 s: a static destructor or atexit handler is blocking in <library> (...); ending the process
    

    Does the process end after about 10 s with that line, or does it still stay until you kill it? If it stays, that is a bug in obs-rust, and I would like to see the end of that log.

    More generally, a plug-in that hangs or slows OBS down should be visible as the cause, not look like an OBS bug. The library name in the watchdog line is a first step. The discussion #4513 collects the next ones, such as time and CPU per plug-in and a start without third-party plug-ins. It will take a while to implement, but your experience with these plug-ins would help there, so feel free to comment.

    For the other hang with NDI monitoring of scenes: when you can isolate it, please open a new issue with the steps, so it does not mix with this one.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions