AssertNotShutdown in multithreaded app

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

AssertNotShutdown in multithreaded app

Postby hunterlaux » Tue Sep 17, 2019 1:14 pm

I recently upgraded to 76.0.3809.132 and it seems like there was an overhaul of the shutdown_checker since the last time I upgraded.

After CefShutdown is called the I hit the following assert on the UI thread.

shutdown_checker::AssertNotShutdown() Line 54 C++
`anonymous namespace'::life_span_handler_on_before_close(_cef_life_span_handler_t * self, _cef_browser_t * browser) Line 198 C++
CefJSDialogHandlerCToCpp::OnDialogClosed(scoped_refptr<CefBrowser> browser) Line 135 C++
CefBrowserHostImpl::DestroyBrowser() Line 1508 C++
CefBrowserInfoManager::DestroyAllBrowsers() Line 332 C++
CefContext::FinishShutdownOnUIThread(base::WaitableEvent * uithread_shutdown_event) Line 609 C++

Am I suppose to be doing some additional cleanup before CefShutdown?
hunterlaux
Techie
 
Posts: 22
Joined: Fri Nov 17, 2017 5:50 pm

Re: AssertNotShutdown in multithreaded app

Postby Czarek » Wed Sep 18, 2019 1:55 am

You should release CEF objects before shutdown.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: AssertNotShutdown in multithreaded app

Postby hunterlaux » Wed Sep 18, 2019 4:06 pm

You should release CEF objects before shutdown.

I don't think that is it.

It seems like CefJSDialogHandlerCToCpp::OnDialogClosed is replacing CefLifeSpanHandler::OnBeforeClose in the wrapper.... Strange.
Attachments
ceflifespan.png
ceflifespan.png (45.47 KiB) Viewed 5615 times
hunterlaux
Techie
 
Posts: 22
Joined: Fri Nov 17, 2017 5:50 pm

Re: AssertNotShutdown in multithreaded app

Postby magreenblatt » Thu Sep 19, 2019 2:41 am

Did you update your project include paths and rebuild libcef_dll_wrapper to match the new CEF version?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: AssertNotShutdown in multithreaded app

Postby rjxray » Mon Sep 23, 2019 5:36 am

I'm having a similar issue after updating from 3.3626.1891 to cef_binary_75.1.16+g16a67c4+chromium-75.0.3770.100_windows64.
I see the same replacement of OnBeforeClose by OnDialogClosed in the wrapper.
Capture.JPG
Capture.JPG (51.52 KiB) Viewed 5585 times


I've cleaned and rebuilt my app and that makes no difference.
I'm directly referencing the includes from my cef.sln build and copying the dll's from there as a Post-Build event

Checking with the the debugger OnBeforeClose() is never called after after I call browser->GetHost()->CloseBrowser(true) during my host window close event handling.

However if I call browser->GetHost()->CloseBrowser(true) during normal execution then OnBeforeClose() is called as expected.

A week or two ago I also tried cef_binary_73.1.13+g6e3c989+chromium-73.0.3683.75_windows64 and had the same issue.
It definitely does not happen with 3.3626.1891
rjxray
Expert
 
Posts: 115
Joined: Wed Jun 07, 2017 4:31 am

Re: AssertNotShutdown in multithreaded app

Postby rjxray » Mon Sep 23, 2019 7:29 am

I think the reference to CefJSDialogHandler is a red herring.
I have been using a release version of libcef.dll with a debug build of my app as per viewtopic.php?f=6&t=16617&p=41200#p41200
On reverting to the debug version of libcef.dll I do see OnBeforeClose in the vfptr.

However I still have the issue of OnBeforeClose() not being called after after I call browser->GetHost()->CloseBrowser(true) during my host window close event handling.
and the application crashes when CefShutDown is called

CallStack.JPG
CallStack.JPG (42.56 KiB) Viewed 5577 times
rjxray
Expert
 
Posts: 115
Joined: Wed Jun 07, 2017 4:31 am

Re: AssertNotShutdown in multithreaded app

Postby rjxray » Wed Nov 27, 2019 4:47 am

I finally figured out the issue and how to solve it.
I am not using CefRunMessageLoop() and am instead calling CefDoMessageLoopWork() on a regular basis.

So I also need to call CefDoMessageLoopWork() in my exit function to allow the browser to close properly

EG
Code: Select all
   bool closed = false;
   while (!closed) {
      closed = browser->GetHost()->TryCloseBrowser();
      CefDoMessageLoopWork();
   }

works for me, after a few iterations OnBeforeClose() is called and then TryCloseBrowser() returns true and then CefShutdown() is happy
rjxray
Expert
 
Posts: 115
Joined: Wed Jun 07, 2017 4:31 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 31 guests