Repository navigation
Conversation
obs64 teardown had no deadline, so a hang left it running after Desktop exited, holding CEF's cache lock and the exit pipe name the next session needs. A watchdog now terminates it on overrun, and the pipe is closed after the ack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Legacy recordings still risk process termination after 10 seconds instead of receiving the 180-second finalization allowance, while watchdog deadline resets can improperly extend preparation and teardown limits.
2 open issues
What changed in this PR
This PR adds Windows shutdown deadlines to reduce leftover obs64 processes that can hold CEF’s cache lock and block the next session.
Changes:
- Adds a staged shutdown watchdog with output-finalization tracking and fake-clock tests.
- Integrates watchdog budgets into shutdown and terminates obs64 after teardown.
- Closes the exit pipe after acknowledgment instead of reconnecting it.
| File | Description |
|---|---|
| obs-studio-server/tests/test-shutdown-watchdog.cpp | Tests deadlines, caps, disarming, and finalization tracking. |
| obs-studio-server/source/shutdown-watchdog.hpp | Defines watchdog budgets and tracking interfaces. |
| obs-studio-server/source/shutdown-watchdog.cpp | Implements deadline monitoring and Windows termination. |
| obs-studio-server/source/osn-output.hpp | Adds per-output finalization tracking. |
| obs-studio-server/source/osn-output.cpp | Tracks output stopping and completion signals. |
| obs-studio-server/source/nodeobs_api.cpp | Integrates shutdown budgets and releases the exit pipe. |
| obs-studio-server/source/main.cpp | Arms preparation monitoring and terminates after teardown. |
| obs-studio-server/CMakeLists.txt | Registers watchdog sources and tests. |
Review effort: Balanced
Comment on lines
+1669
to
+1670
| osn::ShutdownWatchdog::Instance().Arm("Outputs", osn::shutdown_budget::OutputStep); | ||
| osn::ShutdownWatchdog::Instance().SetCap(osn::shutdown_budget::OutputCap); |
| std::lock_guard lock(m_mtx); | ||
| m_finalizing += delta; | ||
| // Each output gets a fresh step once it finishes finalizing. | ||
| if (m_finalizing == 0 && delta < 0 && m_armed) |
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.


Problem: obs64 teardown had no deadline. A hang in
obs_shutdown/CefShutdownor a stuck muxer left obs64 running after Desktop exited. Since 1.22 that leftover holds CEF's cache lock and crashes the next session's obs64 at startup. Theexit-slobs-crash-handlerpipe was also reconnected after the ack, so a leftover kept the name the next session needs.Change (Windows only): a watchdog terminates obs64 when a stage overruns: 15 s before teardown, 30 s per output (up to 180 s while a recording finishes its file), 30 s for teardown. No Sentry report. obs64 also terminates itself once teardown completes, and the exit pipe is closed after the ack.
Effect: no obs64 left behind; recordings still get up to 180 s to finish.
Related: #1820, streamlabs/obs-browser#59
Tests
obs64.exeand unit testsnode ci/run-unit-tests.js: 70/70, incl. 10 new watchdog tests (fake clock)obs_shutdownrepro (cdb): self-terminated at 30 s, exit 0x0B5D0001, no crash report, pipe released; control run exited normallyNot verified: real-recording scenarios (exit while recording, slow muxer under cap, stuck muxer at cap), integration suite, macOS.