OBS/CEF segfaults consistently on application exit #501
Labels
No labels
area/accessibility
area/dependency
Confirmed
Crash Report
Delayed
Design Issue
Duplicate
Feedback required
Good first issue
kind/bug
kind/cleanup
kind/enhancement
platform/linux
platform/macos
platform/windows
priority/high
Question
Request for Comments
Seeking Other Contributors
Seeking Testers
Won't Fix / By Design
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-obsproject/obs-browser#501
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
edit:
Offending commit and workaround found, see comment 7.
Operating System Info
Other
Other OS
Fedora 42
OBS Studio Version
Other
OBS Studio Version (Other)
32.0.0-beta1
OBS Studio Log URL
https://github.com/user-attachments/files/22277058/2025-09-11.16-08-07.txt
OBS Studio Crash Log URL
https://github.com/user-attachments/files/22277059/gdb.txt
Expected Behavior
OBS should be closing the browserdocks and exiting cleanly.
Current Behavior
OBS segfaults on exit, resulting in the "unclean shutdown" dialogue showing each launch.
Steps to Reproduce
Unfortunately reproduction is a bit murky since last time during testing I wasn't able to get it consistently either (which is why I didn't open an issue then), so I can only infer from my main profile where it happens consistently.
https://dashboard.twitch.tv/popout/u/<user>/stream-manager/stream-healthhttps://dashboard.twitch.tv/popout/u/<user>/stream-manager/quick-actionshttps://dashboard.twitch.tv/popout/u/<user>/stream-manager/activity-feed?uuid=<uuid>(not sure why I still have this TBH)https://dashboard.twitch.tv/popout/u/<user>/stream-manager/reward-queue?uuid=<uuid>https://play.pretzel.rocks/my-music/playlistsAnything else we should know?
This used to be a widespread issue (happening with just the Twitch docks even), but was fixed in (IIRC) OBS 30. It started happening again with the OBS 31.1 beta cycle.
On Discord I was troubleshooting with Matt and we ended up increasing the timeout here:
github.com/obsproject/obs-browser@910617b499/panel/browser-panel.cpp (L169-L176)... to 5000, which fixed it for the most part. However it seems to me that increasing the timeout is really only a bandaid and not fixing the actual problem?
Regardless, during testing with a new profile I was unable to reproduce this consistently, which is likely due to not adding all the docks I have in my main profile, where I do get this consistently.
To my knowledge the exact cause of this crash is still unknown, but it was "fixed" with OBS 30 introducing the timeout loop. I have yet to figure out what happened between 31 and 31.1 beta1 to have this reappear, since I didn't get to bisect considering I couldn't reproduce it reliably in testing.
I don't remember if the backtrace from back then was the same/similar, you'd have to check the old beta discord channels for it, pretty sure I posted it.
This crash is likely tangentially related to #353
tytan suggested testing with 6533v6 as well (the previous log was with v5), so here we are:
https://github.com/user-attachments/files/22282679/gdb.txt
To me these GDB backtraces are all hieroglyphs but at first glance it looks to be the same(-ish), except for
Which I don't know what that is because I have all the debug symbols I could get...
Due to the presence of
QMainWindowTabBarin the stack, this almost sounds like QTBUG-137755:github.com/qt/qtbase@cc1ddebf63The stack in that QTBUG is the same as yours. Fixed in Qt 6.9.2 and 6.10+.
This is with Qt 6.9.2 (runtime, I didn't rebuild):
https://github.com/user-attachments/files/22283813/gdb.txt
The only context I can provide is here:
github.com/obsproject/obs-browser@c3b1e81a12/panel/browser-panel.cpp (L237-L253)Line 249 is the offending line in the stack here. Perhaps somehow
cefBrowserstill exists here, but something else is wrong here.Some further pondering:
What's puzzling to me is that
unsetToplevelXdndProxy()seems like it should only be called on initialization. Or at least, it's added to the CEF task queue on initialization. Not sure why it's being called on application exit, unless it's flushing the task queue and it's still stuck in there.github.com/obsproject/obs-browser@c3b1e81a12/panel/browser-panel.cpp (L276-L281)github.com/obsproject/obs-browser@c3b1e81a12/panel/browser-panel.cpp (L326-L328)OK so I've been trying to bisect and started with bisecting
obs-browserfirst because it is the smaller commit count compared to OBS proper.The relevant history is this:
b56fd78936761891475458447c1cc9058bb9c2d4...5ee805695d337cbea4180fd25e5b86bfff4af33b
And here's how it went:
All testing with CEF 6533v6
31.0.3^0
5ee805695dbuild failure :<
31.0.3^1
a54e7c4cb0good
31.0.3^2
0fb70b6a9agood
31.0.3^3
f617868ab1build failure :<
The build failures are this:
And this is beyond me to fix because I have no idea about the codebase.
However,
f617868ab1is windows-specific so should be irrelevant. The commit after that (5ee805695d) only increases the version, and the commit before (0b13eb9b91) introduces the build failure.So unless the problem is the
glVersionchange I think it's safe to say obs-browser is not the issue.Finally done with bisecting OBS commits.
TLDR:
github.com/obsproject/obs-studio@bdebea3d85edit:
It's late so I didn't think of the next logical step which Matt pointed out...
Disabling Hardware Acceleration (in the settings, not by reverting the commit) does indeed fix the crash. Across 8 restarts there was no crash, turned it back on and I immediately got one again.
git bisect good 31.0.3git bisect bad 31.1.0-beta1git bisect good/bad && git submodule update --init --recursiveafter eachTest builds
All testing with CEF 6533v6
31.0.3^4
github.com/obsproject/obs-studio@f03280c4fdgood
31.0.3^5
github.com/obsproject/obs-studio@8f1bcc1798good
31.0.3^6
github.com/obsproject/obs-studio@a19945b53agood
31.0.3^7
github.com/obsproject/obs-studio@6204c22853good
31.0.3^8
github.com/obsproject/obs-studio@b46e5bb1c0good
31.0.3^9
github.com/obsproject/obs-studio@b9cd9f30b1good
31.0.3^10
github.com/obsproject/obs-studio@f6c6b3f9d1good
31.0.3^11
github.com/obsproject/obs-studio@bdebea3d85bad (3/10 good)
31.0.3^12
github.com/obsproject/obs-studio@e8d1834f68good
Acknowledging that the above conclusion seems to be that the browser source hardware acceleration setting seems to be somehow causing this. Unfortunately, debugging that is beyond me, as I primarily work on Windows.
For completeness, this should be because
gs_get_driver_version()was only added in OBS Studio 31.1, so obviously the function is not available when building against 31.0.x (beforegithub.com/obsproject/obs-studio@abb8cdf0da).This crash might be related to similar crashes we see on macOS:
When a browser dock is destroyed it creates a nested event loop to effectively "block" the current call stack to wait up to 1 second for CEF to finish its own shut down.
But this nested event loop will receive all application events (it effectively becomes the "main" event loop for that second) and while CEF might be shutting down all other app events will be handled.
The main issue with this is that this nested event loop is spawned within
OBSBasic's destructor, which is batshit insane on an architectural level (destructors have to be "safe"), but at least on macOS this can lead to aQuitevent being handled within the destructor, which then triggers the same destructor on a half-destructed object again.It doesn't seem this is the specific issue here as well, but having that nested event loop while the "main" event loop is busy draining itself of all remaining events is just a recipe for disaster.