CefShutdown crash in multithread message loop mode

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.

CefShutdown crash in multithread message loop mode

Postby zhubicen » Sat Aug 30, 2014 12:56 am

I am using VS2013, trying the example application: CefClient, it can't close normally, what is wrong?

1. call cefclient with option --multi-threaded-message-loop=true
2. when close the cefclient, cefclient crashes at CefShutdown

Code: Select all
[0830/135439:FATAL:notification_registrar.cc(76)] Check failed: CalledOnValidThread().
Backtrace:
   cef_trace_event_instant [0x0940E9A1+1165953]
   cef_trace_event_instant [0x0935A5DF+427711]
   SetCrashKeyValueImpl [0x09AF7C59+81417]
   SetCrashKeyValueImpl [0x09AF7286+78902]
   SetCrashKeyValueImpl [0x09E43238+3535848]
   SetCrashKeyValueImpl [0x09E43946+3537654]
   SetCrashKeyValueImpl [0x09E43DAF+3538783]
   SetCrashKeyValueImpl [0x09E449C6+3541878]
   cef_trace_event_instant [0x093FB517+1086967]
   cef_trace_event_instant [0x093FB118+1085944]
   cef_trace_event_instant [0x093FB4D5+1086901]
   cef_string_list_value [0x0917DC4F+194751]
   cef_trace_event_instant [0x093FB215+1086197]
   cef_trace_event_instant [0x093FAE5A+1085242]
   SetCrashKeyValueImpl [0x0CE41746+53860598]
   SetCrashKeyValueImpl [0x0CE41706+53860534]
   SetCrashKeyValueImpl [0x0CE436FF+53868719]
   SetCrashKeyValueImpl [0x0CE4369A+53868618]
   SetCrashKeyValueImpl [0x0CE43557+53868295]
   cef_string_list_value [0x09179FA5+179221]
   cef_string_list_value [0x0917B052+183490]
   cef_string_list_value [0x09179EC5+178997]
   cef_shutdown [0x090C2813+67]
   CefShutdown [0x0128DE49+73] (d:\project\duigallery\cef\libcef_dll\wrapper\libcef_dll_wrapper.cc:177)
   wWinMain [0x01284D2B+683] (d:\project\duigallery\cef\cefclient\cefclient_win.cpp:174)
   __tmainCRTStartup [0x012F23AC+540] (f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618)
   wWinMainCRTStartup [0x012F24ED+13] (f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:466)
   BaseThreadInitThunk [0x74F9338A+18]
   RtlInitializeExceptionChain [0x77119F72+99]
   RtlInitializeExceptionChain [0x77119F45+54]

zhubicen
Newbie
 
Posts: 3
Joined: Sat Aug 09, 2014 3:08 am

Re: CefShutdown crash in multithread message loop mode

Postby ScottV » Tue Nov 17, 2015 3:59 pm

This is still a problem.

In Windows using VS2013 and the latest build (CEF 3.2526.1347.gcf20046) adding "--multi-threaded-message-loop" to the "cefclient" command line crashes the cefclient when it reaches "CefShutdown()" on line 122 of the "main_context_impl.cc" file.

Any updates?

Thank you,
--Scott
ScottV
Techie
 
Posts: 27
Joined: Thu Mar 27, 2014 1:22 pm

Re: CefShutdown crash in multithread message loop mode

Postby magreenblatt » Tue Nov 17, 2015 4:24 pm

Try passing the `--disable-extensions` command-line flag. See https://bitbucket.org/chromiumembedded/cef/issues/1680/
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CefShutdown crash in multithread message loop mode

Postby ScottV » Tue Nov 17, 2015 4:28 pm

With the following command line switches the "cefclient" still crashes at CefShutdown();

--multi-threaded-message-loop --disable-extensions

--Scott
ScottV
Techie
 
Posts: 27
Joined: Thu Mar 27, 2014 1:22 pm

Re: CefShutdown crash in multithread message loop mode

Postby ScottV » Tue Nov 17, 2015 4:29 pm

It did not crash in build "3.2272.32.gbda8dc7".

--Scott
ScottV
Techie
 
Posts: 27
Joined: Thu Mar 27, 2014 1:22 pm

Re: CefShutdown crash in multithread message loop mode

Postby ScottV » Thu Nov 19, 2015 3:40 pm

Testing CEF 3 Branch 2526.1352 "cefclient" adding "--multi-threaded-message-loop" to the command line, opening cefclient, waiting for the Google page to load, then closing the browser on Windows 7 64bit compiling with VS2013 via Ninja.

The error starts on line 437 in the file "context.cc" when "main_runner_->Shutdown();" is called.

Code: Select all
  // Shut down the content runner.
  main_runner_->Shutdown();


The error occurs on line 72 in the file "at_exit.cc" when g_top_manager->stack_ size=69 when "task.Run();" is called.

Code: Select all
 while (!g_top_manager->stack_.empty()) {
    base::Closure task = g_top_manager->stack_.top();
    task.Run();
    g_top_manager->stack_.pop();
  }


Line 72 of the "at_exit.cc" file eventually calls line 272 of the "singleton.h" file when "Traits::Delete(reinterpret_cast<Type*>(subtle::NoBarrier_Load(&instance_)));" which triggers the break point.

Code: Select all
  // Adapter function for use with AtExit().  This should be called single
  // threaded, so don't use atomic operations.
  // Calling OnExit while singleton is in use by other threads is a mistake.
  static void OnExit(void* /*unused*/) {
    // AtExit should only ever be register after the singleton instance was
    // created.  We should only ever get here with a valid instance_ pointer.
    Traits::Delete(reinterpret_cast<Type*>(subtle::NoBarrier_Load(&instance_)));
    instance_ = 0;
  }
  static subtle::AtomicWord instance_;


This is consistently when the g_top_manager->stack_ size=69.

Any ideas why this is happening in the "cefclient" with the "--multi-threaded-message-loop" command line?

--Scott
ScottV
Techie
 
Posts: 27
Joined: Thu Mar 27, 2014 1:22 pm

Re: CefShutdown crash in multithread message loop mode

Postby ScottV » Thu Nov 19, 2015 3:56 pm

Testing CEF 3 Branch 2526.1352 "cefclient" adding "--multi-threaded-message-loop" to the command line, opening cefclient, waiting for the Google page to load, then closing the browser on Windows 7 64bit compiling with VS2013 via Ninja.

When starting "cefclient" the "g_top_manager->stack_" is consistently adding "ProcessMapFactory" to the 69th spot in the stack on line 58 of the "at_exit.cc" file.

Code: Select all
  AutoLock lock(g_top_manager->lock_);
  g_top_manager->stack_.push(task);


This would lead me to believe that the "ProcessMapFactory" is not being shutdown correctly when "cefclient" closes.

--Scott
ScottV
Techie
 
Posts: 27
Joined: Thu Mar 27, 2014 1:22 pm

Re: CefShutdown crash in multithread message loop mode

Postby ScottV » Thu Nov 19, 2015 4:38 pm

Further investigation by disabling the extensions on lines 808 - 818 in "content_browser_client.cc" where the "ProcessMapFactory" is being created does not prevent the error when "cefclient" closes.

Code: Select all
   
    if (extensions::ExtensionsEnabled()) {
      // Based on ChromeContentBrowserClientExtensionsPart::
      // AppendExtraRendererCommandLineSwitches
      content::RenderProcessHost* process =
          content::RenderProcessHost::FromID(child_process_id);
      content::BrowserContext* browser_context =
          process ? process->GetBrowserContext() : NULL;
      if (browser_context &&
          extensions::ProcessMap::Get(browser_context)->Contains(
              process->GetID())) {
        command_line->AppendSwitch(extensions::switches::kExtensionProcess);
      }


--Scott
ScottV
Techie
 
Posts: 27
Joined: Thu Mar 27, 2014 1:22 pm

Re: CefShutdown crash in multithread message loop mode

Postby JamesBateson » Tue Nov 24, 2015 6:42 am

I've been getting the same issue after upgrading from 3.1750 to 3.2526.

I'm getting it in the CefClient and our real app, which has multi_threaded_message_loop set to true;

I'm getting the same error message in the log but in a different file. I also get it a bunch of times after shutting the app down.

Code: Select all
[1124/113409:FATAL:non_thread_safe_impl.cc(16)] Check failed: CalledOnValidThread().


I would be grateful for a fix or workaround.
JamesBateson
Newbie
 
Posts: 8
Joined: Wed Feb 06, 2013 5:56 am

Re: CefShutdown crash in multithread message loop mode

Postby magreenblatt » Thu Nov 26, 2015 12:04 am

The new AtExitManager crashes have been fixed in https://bitbucket.org/chromiumembedded/ ... t-23594125. You still need to pass `--disable-extensions`.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Next

Return to Support Forum

Who is online

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