Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait on shutdown for docks to close on Linux ('simplest' solution) #450

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

WizardCM
Copy link
Member

Description

Fixes a 100% reproducible crash on shutdown when running Chromium 127.

This is likely the same crash users have been running into with current CEF with a lower hit rate.

This is a temporary/simplified solution to allow a quick CEF upgrade.

Ideally we should track open docks & count OnBeforeClose calls before fully closing, per CEF documentation.

The CefLifeSpanHandler::OnBeforeClose() method will be called after DoClose() (if DoClose() is called) and immediately before the browser object is destroyed. The application should only exit after OnBeforeClose() has been called for all existing browsers.

The same fix does not seem to be needed for browser sources, likely because they're closed earlier in the shutdown flow.

Motivation and Context

Crashes are bad, including on shutdown.

How Has This Been Tested?

Ubuntu 24.04.

  • 1 dock (Google): waits 30ms
  • 1 dock (YouTube): waits 100ms
  • 2 docks (Google + YouTube)): waits 150ms

Without this fix, using a DCHECK enabled CEF build to read the error message:

[0818/184348.915859:FATAL:alloy_browser_main.cc(417)] Check failed: global_request_context_->HasOneRef(). 

With additional logging in OBS, the culprit was identified as Qt not waiting long enough for browser docks to close.
Good browser dock close (such as closing a single dock with its X):

warning: QCefWidgetInternal::~closeBrowser ---- starting
warning: QCefWidgetInternal::~closeBrowser ---- destroyed
warning: QCefWidgetInternal::~closeBrowser ---- ended
warning: ~QCefBrowserClient() ---- destroyed

Bad browser dock close (closing the app while browser docks are loaded):

warning: QCefWidgetInternal::~closeBrowser ---- starting
warning: QCefWidgetInternal::~closeBrowser ---- destroyed
warning: QCefWidgetInternal::~closeBrowser ---- ended
warning: QCefWidgetInternal::~QCefWidgetInternal ---- closed

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Temporary solution to allow a CEF upgrade.
Ideally we should track open docks & count `OnBeforeClose` calls.
@WizardCM WizardCM added the Bug Fix Non-breaking change which fixes an issue label Aug 18, 2024
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As no other more robust solution has materialized, this will have to do "for now" to prevent this crash on shutdown.

@RytoEX RytoEX merged commit 6451941 into obsproject:master Aug 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Non-breaking change which fixes an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants