CEF3: CloseContents Crashing with Windowed rendering

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.

CEF3: CloseContents Crashing with Windowed rendering

Postby mmagdy » Mon Feb 24, 2014 7:18 am

Hello,

We've deployed our application to a few hundred users. We've been collecting mini crash dumps since then. We're seeing the following stack trace come up frequently:

libcef!CefBrowserHostImpl::CloseContents+0x143 [c:\cef\workspace\cef3-windows-1650\download\chromium\src\cef\libcef\browser\browser_host_impl.cc @ 1617]
libcef!content::WebContentsImpl::Close+0x2a [c:\cef\workspace\cef3-windows-1650\download\chromium\src\content\browser\web_contents\web_contents_impl.cc @ 3242]
libcef!content::RenderViewHostImpl::OnClosePageACK+0x2f [c:\cef\workspace\cef3-windows-1650\download\chromium\src\content\browser\renderer_host\render_view_host_impl.cc @ 1605]
libcef!IPC::Message::Dispatch<content::RenderViewHostImpl,content::RenderViewHostImpl>+0x19 [c:\cef\workspace\cef3-windows-1650\download\chromium\src\ipc\ipc_message.h @ 148]
libcef!content::RenderViewHostImpl::OnMessageReceived+0x8e0 [c:\cef\workspace\cef3-windows-1650\download\chromium\src\content\browser\renderer_host\render_view_host_impl.cc @ 987]
libcef!content::RenderProcessHostImpl::OnMessageReceived+0x33a [c:\cef\workspace\cef3-windows-1650\download\chromium\src\content\browser\renderer_host\render_process_host_impl.cc @ 1282]
libcef!IPC::ChannelProxy::Context::OnDispatchMessage+0xb0 [c:\cef\workspace\cef3-windows-1650\download\chromium\src\ipc\ipc_channel_proxy.cc @ 270]
libcef!base::internal::Invoker<2,base::internal::BindState<base::internal::RunnableAdapter<void (__thiscall net::DhcpProxyScriptAdapterFetcher::DhcpQuery::*)(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)>,void __cdecl(net::DhcpProxyScriptAdapterFetcher::DhcpQuery *,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &),void __cdecl(net::DhcpProxyScriptAdapterFetcher::DhcpQuery *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >)>,void __cdecl(net::DhcpProxyScriptAdapterFetcher::DhcpQuery *,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)>::Run+0x16 [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\bind_internal.h @ 1253]
libcef!base::MessageLoop::RunTask+0x2e4 [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\message_loop\message_loop.cc @ 493]
libcef!base::MessageLoop::DoWork+0x4ba [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\message_loop\message_loop.cc @ 618]
libcef!base::MessagePumpForUI::DoRunLoop+0x5c [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\message_loop\message_pump_win.cc @ 244]
libcef!base::MessagePumpWin::Run+0x3e [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\message_loop\message_pump_win.h @ 48]
libcef!base::MessageLoop::RunInternal+0x9f [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\message_loop\message_loop.cc @ 441]
libcef!base::RunLoop::Run+0x13 [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\run_loop.cc @ 48]
libcef!base::MessageLoop::Run+0x16 [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\message_loop\message_loop.cc @ 312]
libcef!base::Thread::Run+0xb [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\threading\thread.cc @ 160]
libcef!base::Thread::ThreadMain+0xca [c:\cef\workspace\cef3-windows-1650\download\chromium\src\base\threading\thread.cc @ 223]
...

I'm aware of issue #1121 https://code.google.com/p/chromiumembed ... il?id=1121 However, we're using windowed rendering.
I'm closing all CefBrowser instances as instructed by the documentation. The crashes seem to be random, and unfortunately I do not have a debug stacktrace because a) we do not know how to reproduce the crash, and b) the mini-crash dumps we have, are coming from our release version, which is deployed to our users.


CEF 3.1650.1617 (32-bit)
using multithreaded message loop and multiprocess,

Thanks in advance,
mmagdy
Techie
 
Posts: 10
Joined: Wed Jan 08, 2014 5:28 pm

Re: CEF3: CloseContents Crashing with Windowed rendering

Postby magreenblatt » Mon Feb 24, 2014 8:46 am

What kind of crash is it? For example, invalid read, invalid write, etc. What is the memory address?
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: CEF3: CloseContents Crashing with Windowed rendering

Postby mmagdy » Mon Feb 24, 2014 9:51 am

The crash is
Code: Select all
Access violation - code c0000005


It seems to be crashing when calling |Release()|, but that's an assumption based on the line number shown in the crash dump.
mmagdy
Techie
 
Posts: 10
Joined: Wed Jan 08, 2014 5:28 pm

Re: CEF3: CloseContents Crashing with Windowed rendering

Postby magreenblatt » Mon Feb 24, 2014 10:12 am

mmagdy wrote:The crash is
Code: Select all
Access violation - code c0000005


It seems to be crashing when calling |Release()|, but that's an assumption based on the line number shown in the crash dump.

Are you doing any manual reference counting in your application (calling AddRef/Release directly instead of using CefRefPtr)?
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: CEF3: CloseContents Crashing with Windowed rendering

Postby mmagdy » Mon Feb 24, 2014 10:43 am

Are you doing any manual reference counting in your application (calling AddRef/Release directly instead of using CefRefPtr)?

Absolutely not. If that was the case, we would be seeing the error more consistently and we would see our own methods popup in some of the crash-dump call stacks.
mmagdy
Techie
 
Posts: 10
Joined: Wed Jan 08, 2014 5:28 pm

Re: CEF3: CloseContents Crashing with Windowed rendering

Postby mmagdy » Fri Apr 11, 2014 8:51 am

I found the solution.
I was following the advice posted here. However, I was missing a check for IsPopup. We don't want to call DestroyWindow if it's a popup. The normal workflow of WM_CLOSE, DoClose, WM_CLOSE, WM_DESTROY works fine in that case.
mmagdy
Techie
 
Posts: 10
Joined: Wed Jan 08, 2014 5:28 pm

Re: CEF3: CloseContents Crashing with Windowed rendering

Postby pureal » Mon May 26, 2014 9:11 am

hi, mmagdy
I have exactly the same problem as yours, the crash stack is equal.
I don't understand how to fix it by your description, Can you paste your DoClose() here?

thanks,
David
pureal
Newbie
 
Posts: 1
Joined: Thu Apr 17, 2014 10:41 pm

Re: CEF3: CloseContents Crashing with Windowed rendering

Postby mmagdy » Wed May 28, 2014 7:17 am

Code: Select all
bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
   REQUIRE_UI_THREAD();
   if (!browser->IsPopup()) {
      AutoLock lock_scope(this);
      if (m_Browsers.size() == 1) {
         m_bIsClosing = true;
         return false; // sends WM_CLOSE to main frame
      }
      // Destroy window to shutdown renderer process
      PostMessage(browser->GetHost()->GetWindowHandle(), WM_DESTROY, 0 , 0);
      return true;
   }
   return false; // this is a popup, send WM_CLOSE to close it.
}

mmagdy
Techie
 
Posts: 10
Joined: Wed Jan 08, 2014 5:28 pm


Return to Support Forum

Who is online

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