Skip to content

obs-exit-watchdog: Name the library and the plugin that block exit - #4560

Merged
vpacher merged 5 commits into
masterfrom
fix/4525-watchdog-names-library
Nov 10, 2026
Merged

vpacher merged 5 commits into
masterfrom
fix/4525-watchdog-names-library

Conversation

@vpacher

@vpacher vpacher commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Fixes #4525 (PR 2 of 2; PR 1 was #4549, the module image table).

What: when the exit watchdog fires, its line now names the library the main thread waits in and the module that brought it in:

exit-watchdog: exit did not finish in 10 s: a static destructor or atexit handler is blocking in libremidi.so.4 (loaded by advanced-scene-switcher.so); ending the process
  • Frontend: after the modules load, the plugin manager notes each module's binary path and the image list, and again after their post-load (obs_exit_watchdog_note_module, _note_loaded, _note_post_load).
  • arm: builds the table (obs-exit-watchdog: Record which module brought in which libraries #4549) from these notes and the list at arming, and notes the arming thread, which is the main thread that then runs exit().
  • Firing: the watchdog captures that thread's stack and names the first frame in an image OBS did not load itself. The capture and the line use fixed buffers, so firing allocates nothing.
  • macOS bundles: libobs names a plugin by its bundle (x.plugin), and the image list has the binary inside it, so a module also matches a directory of the image path (separate RED/GREEN pair).

RED 2bbcf23: 5 new cases in obs-tests-gpu; 9 exit_watchdog cases fail with "not yet implemented". GREEN 0628849. RED eef6980 (bundle case) / GREEN 79aa5cf. Frontend b96bcd8. All 17 exit_watchdog cases pass on macOS (arm64) and Linux (x86_64), including a child whose blocked thread gets named through the real capture path on each OS.

App check (macOS, RelWithDebInfo build with the exit-blocker test plugin: a static destructor joins a thread that never ends, the #3739 pattern), quit with SIGTERM: rc 124 after 11 s, and in the log and on stderr:
... atexit handler is blocking in exit-blocker (an OBS module); ending the process.
Without the plugin: rc 0 after 1 s, no line. Not checked in a Linux app build; on Linux the child test covers the signal path.

Tiers: Tier 1. The C changes are frontend-only (the plugin manager and a frontend header), with no libobs or public header change, so Tiers 2 to 4 don't apply.

Test cost: new tests: longest 0.27 s (a child with a 200 ms watchdog), peak RSS 10.5 MB over 25 runs (Linux). One own thread, blocked until the test binary ends, and one child process.

Features ledger: a line under the exit watchdog entry.

🤖 Generated with Claude Code

vpacher and others added 5 commits November 10, 2026 14:51
The watchdog line names the library the armed thread waits in and the
OBS module that brought it in (#4525, PR 2): the line text, the choice of
the first frame outside OBS's own images, another thread's stack, and a
blocked child whose line names the test binary as a module's library.
arm, culprit, the line writer, the note_* calls and the Linux and macOS
stack capture are todo!() stubs: 9 exit_watchdog cases of obs-tests-gpu
fail with "not yet implemented" (the 7 image-table cases pass).

Refs #4525

Co-Authored-By: Claude Opus 5.5 <[email protected]>
arm builds the module image table from what the frontend noted (the
modules, the image list after loading and after post-load) and the list
at arming, and notes the arming thread. When the watchdog fires, it
captures that thread's stack, takes the first frame in an image OBS did
not load itself, and names that library and who brought it in:

  exit-watchdog: exit did not finish in 10 s: a static destructor or
  atexit handler is blocking in libremidi.so.4 (loaded by
  advanced-scene-switcher.so); ending the process

The capture and the line use fixed buffers. Linux: a real-time signal
runs backtrace(3) on the thread (the unwinder is loaded at arming).
macOS: the thread is suspended and its frame pointer chain walked inside
its stack. Other hosts name no library. The C ABI gets note_module,
note_loaded and note_post_load.

All 16 exit_watchdog cases of obs-tests-gpu pass on macOS and Linux.

Refs #4525

Co-Authored-By: Claude Opus 5.5 <[email protected]>
libobs names a macOS plugin by its bundle (exit-blocker.plugin), the
image list by the binary inside it (.../exit-blocker.plugin/Contents/
MacOS/exit-blocker), so a match by file name alone finds no module on
macOS. The new case fails: every image is OBS's own.

Refs #4525

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A module also matches an image when its name is a directory of the
image's path, so exit-blocker.plugin owns .../exit-blocker.plugin/
Contents/MacOS/exit-blocker and the libraries after it. All 17
exit_watchdog cases pass.

Refs #4525

Co-Authored-By: Claude Opus 5.5 <[email protected]>
After the modules load, the plugin manager notes each module's binary
path and the image list (obs_exit_watchdog_note_module, _note_loaded),
and again after their post-load (_note_post_load), so the watchdog line
names the library that blocks exit and the module that brought it in.

macOS app with the exit-blocker test plugin (a static destructor joins a
thread that never ends), quit with SIGTERM: rc 124 after 11 s and, in
the log and on stderr:

  exit-watchdog: exit did not finish in 10 s: a static destructor or
  atexit handler is blocking in exit-blocker (an OBS module); ending
  the process

Without the plugin: rc 0 after 1 s, no line. Features ledger line added.

Refs #4525

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ci-Attestation: {"at":1794319376,"gate":"rust/aarch64-apple-darwin/clippy","host":"darwin-arm64","key":"","lane":"cross","parents":["79aa5cf9525df04d7fdaa021f333064a49a4ed0c"],"secs":99,"stamp":"57b9f1145acfde65ed8b03e6013ced46","tree":"3ec7e42c994234432e0486bcad94887fe7cc225c","v":1,"via":"run"}
Ci-Attestation: {"at":1794319376,"gate":"rust/all/fmt","host":"darwin-arm64","key":"","lane":"lint","parents":["79aa5cf9525df04d7fdaa021f333064a49a4ed0c"],"secs":99,"stamp":"5f484013f1f1af72c7f084e4e4596399","tree":"3ec7e42c994234432e0486bcad94887fe7cc225c","v":1,"via":"run"}
@vpacher vpacher changed the title frontend: Note the modules and images for the exit watchdog obs-exit-watchdog: Name the library and the plugin that block exit Nov 10, 2026
@github-actions github-actions Bot added the claim-conflict A PR closing reference conflicts with the issue claim label Nov 10, 2026
@github-actions

Copy link
Copy Markdown

Claim conflict: keep this PR out of the merge queue until resolved.

@github-actions github-actions Bot removed the claim-conflict A PR closing reference conflicts with the issue claim label Nov 10, 2026
@vpacher
vpacher marked this pull request as ready for review November 10, 2026 14:45
@vpacher
vpacher requested a review from zackees as a code owner November 10, 2026 14:45
@vpacher
vpacher added this pull request to the merge queue Nov 10, 2026
Merged via the queue into master with commit 8d24051 Nov 10, 2026
42 of 43 checks passed
@vpacher
vpacher deleted the fix/4525-watchdog-names-library branch November 10, 2026 14:56
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Nov 10, 2026
…t#4584)

The quit-hang concept stopped at "Number of memory leaks". Since obs-rust#4309
the exit watchdog adds a last line, and since obs-rust#4560 that line names the
library and the plugin that loaded it. Add it as line 7, say how to read
the name and where it can mislead, and that gdb must attach within the
watchdog's 10 s.

Refs obs-rust#4525


Ci-Attestation: {"at":1794333181,"gate":"rust/all/fmt","host":"darwin-arm64","key":"","lane":"lint","parents":["edd24c57e13fc326fd79620d269ee3530dd548fe"],"secs":90,"stamp":"430982cd8ee5f2d77a15469a0b233205","tree":"ccfd658271982e6b830e48f1a9ecbbc301a7088a","v":1,"via":"run"}

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: frontend: the exit watchdog does not name the plugin that blocks exit

1 participant