Repository navigation
Description
Location
plugins/obs-browser/obs-browser-plugin.cpp (submodule obs-rust/obs-browser at 463e16b):
obs_module_unload(), Linux path withoutENABLE_BROWSER_QT_LOOP:os_event_wait(cef_initialized_event)has no time limit. The manager thread signals that event only whenBrowserInit()(and soCefInitialize()) returns.BrowserManagerThread()/BrowserInit(): whenCefInitialize()does not return, nothing is logged and nothing is shown to the user.
Found while investigating #3739.
Class
Hang at quit, and a silent loss of a feature. Only trusted local input reaches it: the installed CEF and the user's own scene collection.
How it is reached
Seen on Arch Linux (Hyprland, Wayland) with the AUR obs-rust-git package built against the Arch cef package 152.0.6. With that CEF, CefInitialize() does not return. gdb shows BrowserInit() entered, and neither the context-initialized callback nor the line after BrowserInit() reached in 40 s. Why that CEF stalls is not known; the same build against cef 154.0.34 works.
Then:
- A browser source never renders, not even a local
data:page. The log has no error. - At quit,
obs_shutdown()unloads obs-browser and the main thread waits forever:The window is gone,obs_shutdown() -> free_module(obs-browser) -> obs_module_unload() obs-browser-plugin.cpp:1015 os_event_wait(cef_initialized_event)obs-studio-rust-guiand theobs-browser-pagezygote processes stay, and SIGHUP or SIGTERM do not end them. The next start reports that OBS is already running.
Measured with the same build, same scene, quit by window close and by SIGHUP:
cef |
Browser source | Quit |
|---|---|---|
| 152.0.6 | blank | hangs, 4 of 4 |
| 154.0.34 | renders | 1 to 2 s, 4 of 4 |
With 152, every other run with a browser source hung too (16 more runs, with the variations below).
The stall does not depend on the CEF sandbox (also with the sandbox off), on Wayland (also with XWayland), on the session D-Bus (also without it) or on the GPU (also with --disable-gpu).
The wait was added by 0c3b700 (10-17) to coordinate unload with a CEF that is still starting. That coordination is correct and must stay. Before it, obs_module_unload() called manager_thread.join(), which hangs in the same way on a CEF that does not return.
Proposed fix and failing test
Two PRs, in this order:
- Quit does not wait forever. Wait for
cef_initialized_eventwith a time limit (os_event_timedwait). When the limit passes, log an error, do not post the quit task, do not join the manager thread, and let OBS shut down. Keep the 0c3b700 behavior for every CEF that starts or fails within the limit. Open point: the manager thread is still insideCefInitialize()when the process exits, so library destructors run while it is there. The test must show that the exit does not crash, and that theobs-browser-pagehelper processes end too. If a normal exit is not safe, end the process with_exit()after the shutdown of everything else, and log why. - The user learns that CEF did not start. If
BrowserInit()has not returned some seconds after the first browser source or dock asks for CEF, log an error that names the CEF version, and show one warning that browser sources and docks will not work. A failedCefInitialize()(the existing "CEF failed to initialize" path) gets the same warning.
RED for 1: a variant of tests/startup_shutdown.py in which CefInitialize() does not return. CEF cannot be made to stall on demand, so the test interposes one symbol, cef_initialize, with an LD_PRELOAD shim that blocks until the test releases it. Everything else stays real. Without the fix, OBS shutdown does not finish within the test's bound; with the fix, it finishes, and the log has the error. The existing initialization_failure.py and immediate-unload cases must still pass.
RED for 2: the same shim, and an assertion that the error and the warning appear once, within the limit.
What is still open: the time limits, and whether the warning is a log line only or also a dialog.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Nov 7, 2026
Claiming: #3833 (pool slot obs-studio3).
Decisions: use a log warning for the startup failure, so headless use is covered without requiring a modal dialog. No CEF support-version policy changes. Refs #3739; not taking that issue.
zackees commentedon Nov 7, 2026
/ready
The pool assignment authorizes implementation. Deterministic RED: interpose cef_initialize and block it; require bounded quit, a startup warning, helper cleanup, and normal/slow-init controls. CEF version support decisions remain out of scope.
fix: bound stalled browser startup and finalize shutdown safely (obs-…
docs(knowledge): Where a quit hang waits, from the last lines of the …
rdoupe commentedon Nov 15, 2026
Fixed by #3846 together with obs-rust/obs-browser#19 (both merged 2026-11-07): stalled CEF startup now has a bounded quit and a startup warning. They said
Refs, so this stayed open. Closing.