Repository navigation
Let an orphaned obs64 decide whether to wait for the user - #1829
Merged
Merged
Conversation
obs64 waited indefinitely on crash-handler's ack over one global exit pipe, even with nothing live, and a leftover obs64 holding that pipe broke the next session. It now reports live outputs to crash-handler, uses a per-session exit pipe, and stops waiting when idle or when crash-handler dies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Activity polling can dereference freed manager objects after API teardown and unprotected legacy output pointers during concurrent replacement or release, creating critical crash risks.
2 open issues
What changed in this PR
This PR extends the shutdown watchdog work in #1821 so orphaned Windows obs64 processes can decide whether to wait for the crash-handler based on live outputs and handler availability.
Changes:
- Tracks output activity and reports it through the new
OUTPUT_STATEcommand. - Adds per-session exit pipes alongside legacy support, with immediate idle shutdown and a five-second grace period after crash-handler loss.
- Adds unit tests for orphan shutdown decisions.
| File | Description |
|---|---|
| obs-studio-server/tests/test-orphan-policy.cpp | Tests acknowledgement, idle outputs, and handler-loss timing. |
| obs-studio-server/source/osn-output.hpp | Declares atomic output activity tracking. |
| obs-studio-server/source/osn-output.cpp | Updates activity snapshots from output lifecycle signals. |
| obs-studio-server/source/orphan-policy.hpp | Defines orphan wait and shutdown decisions. |
| obs-studio-server/source/nodeobs_service.cpp | Marks output state dirty on legacy output signals. |
| obs-studio-server/source/nodeobs_api.h | Declares output-state query and publishing methods. |
| obs-studio-server/source/nodeobs_api.cpp | Implements state reporting, handler tracking, exit pipes, and orphan waiting. |
| obs-studio-server/source/main.cpp | Publishes output state during the Windows main loop. |
| obs-studio-server/CMakeLists.txt | Registers the orphan policy header and tests. |
Review effort: Balanced
…tracking The crash-handler output-state poll walked registries whose objects are freed by destroyOBS_API while the main loop keeps running. Publishing is now gated by a mutex-guarded flag that destroy clears first. Legacy OBS_service outputs are no longer tracked: Desktop only starts the legacy virtual cam, which does not count as live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o fix/obs64-orphan-policy
sandboxcoder
approved these changes
Nov 4, 2026
summeroff
added a commit
that referenced
this pull request
Nov 17, 2026
…1852) * Report a previous server that can't be stopped because it runs elevated (#1830) * Report a previous server that can't be stopped because it runs elevated A non-elevated Desktop cannot open, and so cannot kill, an elevated leftover obs64. That process holds CEF's cache lock, so browser sources are disabled for the session with no explanation. Record its PID and expose it via IPC.getUnkillableStaleServer() so the app can tell the user. * Let an orphaned obs64 decide whether to wait for the user (#1829) * Let an orphaned obs64 decide whether to wait for the user obs64 waited indefinitely on crash-handler's ack over one global exit pipe, even with nothing live, and a leftover obs64 holding that pipe broke the next session. It now reports live outputs to crash-handler, uses a per-session exit pipe, and stops waiting when idle or when crash-handler dies. * Report aborts and terminates on obs64 worker threads (#1850) Terminate handlers are per-thread on MSVC and the SIGABRT handler is one-shot, so after obs_startup a worker-thread abort/terminate ran HandleCrash once, then its final abort() hit SIG_DFL and fast-failed with no crash report. The stack was also logged only after the log was captured. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * Clear output registries on destroy and count legacy outputs as live destroyOBS_API deleted streaming/file-output wrappers but left their registry entries, so a re-init could poll freed pointers. AnyLiveOutput also ignored raw outputs started through the legacy OBS_service API, reporting no live output while one was running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Stop polling legacy OBS_service outputs for live state releaseStreamingOutput frees and nulls those outputs on a worker thread with no lock shared with the main-loop poll, so reading them could touch a freed output. Desktop does not stream or record through OBS_service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stacked on #1821.
Problem: When Desktop dies, obs64 waits on crash-handler's ack over one global exit pipe with no timeout, even if nothing is live. If crash-handler is dead it waits forever, and a leftover obs64 holding the pipe breaks the next session.
Change (Windows): obs64 reports live outputs (stream, record, replay buffer) to crash-handler via new OUTPUT_STATE = 6. Orphaned, it shuts down at once if idle, or on ack, or 5 s after crash-handler dies. Per-session exit pipe plus the legacy one. Ships together with the crash-handler PR.
Effect: No stuck obs64 after a crash; recordings still finalize.
Tests:
node ci/run-unit-tests.js: server 78/78, client 126/126; clang-format 18.1.3 cleanNot verified: outputs ending while kept alive (unit only), integration suite, macOS.
🤖 Generated with Claude Code