Repository navigation
Skip CEF initialization while another process holds the cache lock - #59
Merged
Merged
Conversation
With CEF 6613 on Windows, CefInitialize fails when a leftover obs64 still holds the profile's process-singleton lock, and CEF's teardown after the failed init crashes with a use-after-free. Check the lockfile first, wait up to 3s for the previous instance to release it, and otherwise take the existing init-failure path. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The harness does not exercise two obs64 instances on Windows with CEF 6613, leaving actual singleton-lock detection and crash-free timeout handling unverified.
No open issues 🎉
What changed in this PR
Adds a Windows-only cache-lock check before CEF initialization to avoid the reported startup crash when another process still holds the browser profile lock.
Changes:
- Probes the existing Chromium lockfile without creating a file, waiting up to three seconds for release.
- If the lock remains held or shutdown is requested during the wait, logs an error and takes the initialization-failure path, disabling browser sources for the session.
| File | Description |
|---|---|
| obs-browser-plugin.cpp | Adds lock detection and bounded polling before CEF initialization on Windows. |
Review effort: Balanced
summeroff
added a commit
to streamlabs/obs-studio
that referenced
this pull request
Oct 30, 2026
Picks up streamlabs/obs-browser#59: a leftover obs64 holding the CEF profile lock no longer crashes the next launch at startup.
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: On Windows with CEF 6613, if a leftover obs64 still holds the profile's process-singleton lock,
CefInitializefails and CEF's teardown hits a use-after-free, crashing obs64 at startup (SentryContentMainRunnerImpl::Shutdown, 38 reports / 15 users since 1.22).Change: Before
CefInitialize, check<cache dir>\lockfile(held by Chromium withGENERIC_WRITE+FILE_SHARE_READ+DELETE_ON_CLOSE). Wait up to 3 s for the previous instance to release it; if still held, log an error and take the existing init-failure path. Companion: obs-studio-node now waits for the previous server to exit (separate PR).Effect: Browser sources are disabled for that session instead of Desktop crashing.
Tests
cmake --build build_x64 --config RelWithDebInfo --target obs-browser: builds--dry-run -Werror: clean