Crash in LoadURL/OnRenderProcessTerminated [Fixed]

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.

Crash in LoadURL/OnRenderProcessTerminated [Fixed]

Postby druidsbane » Sun Jul 13, 2014 6:08 pm

Hi! I've been working on integrating CEF as an offline renderer for a new app and I've run into stability issues with the latest Windows x64 build off of trunk. I've gotten it to be pretty stable running using the multi-process method and the sample code provided. It appears to be pretty stable overall, however if I end up just calling
Code: Select all
browser->GetMainFrame()->LoadURL(L"http://google.com");
from the main thread it crashes. The next step is the callback for which I've implemented similar to the tutorial, it crashes when calling LoadURL:

Code: Select all
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
      TerminationStatus status) OVERRIDE{
      message_router_->OnRenderProcessTerminated(browser);

      // Load the startup URL if that's not the website that we terminated on.
      CefRefPtr<CefFrame> frame = browser->GetMainFrame();
      std::string url = frame->GetURL();
      std::transform(url.begin(), url.end(), url.begin(), tolower);

      std::string startupURL = "http://google.com"; // GetStartupURL();
      if (frame->IsValid() && startupURL != "chrome://crash" && !url.empty() && url.find(startupURL) != 0) {
         frame->LoadURL(startupURL);
      }
   }


Below is the stack trace:

Code: Select all
[0713/185512:FATAL:mojo_application_host.cc(33)] Check failed: !client_handle_.is_valid(). Already initialized!
Backtrace:
   cef_time_to_timet [0x0000008B7EEDC006+2699494]
   cef_time_to_timet [0x0000008B7EDFAE6D+1777485]
   SetCrashKeyValueImpl [0x0000008B7FA0D5C5+2770133]
   SetCrashKeyValueImpl [0x0000008B7F7A1372+230018]
   SetCrashKeyValueImpl [0x0000008B7F8B2707+1349143]
   SetCrashKeyValueImpl [0x0000008B7F806D4F+646239]
   SetCrashKeyValueImpl [0x0000008B7FBF8303+4780563]
   SetCrashKeyValueImpl [0x0000008B7FBF88CF+4782047]
   SetCrashKeyValueImpl [0x0000008B7FC8AED2+5381602]
   SetCrashKeyValueImpl [0x0000008B7FC8B41F+5382959]
   SetCrashKeyValueImpl [0x0000008B7F80E309+676377]
   SetCrashKeyValueImpl [0x0000008B7FC28423+4977459]
   SetCrashKeyValueImpl [0x0000008B7FC2760E+4973854]
   SetCrashKeyValueImpl [0x0000008B7FC2805E+4976494]
   SetCrashKeyValueImpl [0x0000008B7FC2772D+4974141]
   cef_string_multimap_value [0x0000008B7EBF74F4+182820]
   cef_time_to_timet [0x0000008B7ECDD8CB+608683]
   cef_drag_data_create [0x0000008B7EB2E1E3+22499]
   CefFrameCToCpp::LoadURL [0x00007FFA2C4DDB20+208] (libcef_dll\ctocpp\frame_ctocpp.cc:178)
   BrowserClient::OnRenderProcessTerminated [0x00007FFA2C45E24F+719] (Custombrowserprivate.cpp:129)
   request_handler_on_render_process_terminated [0x00007FFA2C4CC87C+220] (libcef_dll\cpptoc\request_handler_cpptoc.cc:370)
   cef_request_context_get_global_context [0x0000008B7EB5088D+13693]
   cef_string_multimap_value [0x0000008B7EBFC73F+203887]
   SetCrashKeyValueImpl [0x0000008B7F815B85+707221]
   SetCrashKeyValueImpl [0x0000008B7F8B9972+1378434]
   SetCrashKeyValueImpl [0x0000008B7F8A54C5+1295317]
   SetCrashKeyValueImpl [0x0000008B7F8A4539+1291337]
   SetCrashKeyValueImpl [0x0000008B7F8B83B8+1372872]
   SetCrashKeyValueImpl [0x0000008B7F7A4BC0+244432]
   SetCrashKeyValueImpl [0x0000008B7F7A2F21+237105]
   cef_time_to_timet [0x0000008B7F72E8D2+11426226]
   cef_time_to_timet [0x0000008B7F72FC61+11431233]
   cef_time_to_timet [0x0000008B7F72DFEA+11423946]
   cef_time_to_timet [0x0000008B7F72F69E+11429758]
   cef_string_wide_to_utf8 [0x0000008B7EBB04ED+240653]
   cef_time_to_timet [0x0000008B7EE32487+2004327]
   cef_time_to_timet [0x0000008B7EE2F8E1+1993153]
   cef_time_to_timet [0x0000008B7EE2FFE4+1994948]
   cef_time_to_timet [0x0000008B7EF2BB2F+3025935]
   cef_time_to_timet [0x0000008B7EF2D72C+3033100]
   cef_time_to_timet [0x0000008B7EF2D675+3032917]
   cef_time_to_timet [0x0000008B7EE32053+2003251]
   cef_time_to_timet [0x0000008B7EEBB5FE+2565854]
   cef_time_to_timet [0x0000008B7EEBB641+2565921]
   cef_time_to_timet [0x0000008B7EC91965+297541]
   cef_string_wide_to_utf8 [0x0000008B7EBAAE5D+218493]
   cef_do_message_loop_work [0x0000008B7EADF6DA+26]
   CefDoMessageLoopWork [0x00007FFA2C46966B+27] (libcef_dll\wrapper\libcef_dll_wrapper.cc:249)
   CustomBrowser::tick [0x00007FFA2C464AD0+48] (Custombrowserprivate.cpp:379)
   CCustomBrowser::tick [0x00007FFA2C453BE8+56] (Custombrowser.cpp:34)
   tickBrowser [0x00007FFA2C6A2E80+44] ()
   TBaseStaticDelegateInstance_NoParams_OneVar<void,FParameters * __ptr64>::Execute [0x00007FFA2C690C6B+47]
   TBaseStaticDelegateInstance_NoParams_OneVar<void,FParameters * __ptr64>::ExecuteIfSafe [0x00007FFA2C690D02+46]
   TBaseDelegate_NoParams<void>::ExecuteIfBound [0x00007FFA2C690CCA+86]
   TGraphTask<FSimpleDelegateGraphTask>::ExecuteTask [0x00007FFA2C691EF0+1396]
   FFileManagerGeneric::ProcessCommandLineOptions [0x00007FFA37050D42+2610]
   FFileManagerGeneric::ProcessCommandLineOptions [0x00007FFA37050EFD+3053]
   FStatsWriteFile::ResetData [0x00007FFA371FCBA2+1666]
   FWindowsWindow::Restore [0x00007FFA372BB389+105]
   FWindowsWindow::GetWindowBorderSize [0x00007FFA372B4CF2+162]
   BaseThreadInitThunk [0x00007FFA4E5016AD+13]
   RtlUserThreadStart [0x00007FFA50C84629+29]



Any help solving this would be great. Do you think that trunk is just unstable or am I writing the app wrong? I've been trying to have a minimal number of handlers and callbacks. The renderer copies memory to a DirectX surface. There are no messages about the renderer crashing so I'm not sure how to catch or recover that, just this callback.
Last edited by druidsbane on Sun Jul 13, 2014 11:47 pm, edited 1 time in total.
druidsbane
Newbie
 
Posts: 6
Joined: Sun Jul 13, 2014 5:59 pm

Re: LoadURL crashes, then crash in OnRenderProcessTerminated

Postby magreenblatt » Sun Jul 13, 2014 8:55 pm

OnRenderProcessTerminated is called when the render process crashes. What is causing the render process to crash? Do you only get the check failed when calling LoadURL from OnRenderProcessTerminated?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: LoadURL crashes, then crash in OnRenderProcessTerminated

Postby druidsbane » Sun Jul 13, 2014 9:38 pm

Unfortunately I don't know what's causing the crash. Nothing is showing up in the verbose logs about the crash. The crash seems to happen anytime I call LoadURL. So on startup I load a page using the CreateBrowserSync method but then calling LoadURL directly after (hardcoded) or shortly after (user input) it crashes with the stack you saw below. I can test with something other than Google, could be the JavaScript in today's page?
druidsbane
Newbie
 
Posts: 6
Joined: Sun Jul 13, 2014 5:59 pm

Re: LoadURL crashes, then crash in OnRenderProcessTerminated

Postby magreenblatt » Sun Jul 13, 2014 9:47 pm

Yeah, try a different URL (or a release build of libcef). Google doodles tend to hit Blink debug assertions.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: LoadURL crashes, then crash in OnRenderProcessTerminated

Postby druidsbane » Sun Jul 13, 2014 11:45 pm

Wow, extremely impressive :) I rebuilt and linked everything in Release mode and not only the browser not crash but it is just as fast as Chrome now, I was quite worried before at how laggy and slow it felt relative to Chrome and how slow it was to just load up pages. I didn't realize that the debug build had that effect, pages just pop up instantly now. Thank you so much and amazing work on CEF!
druidsbane
Newbie
 
Posts: 6
Joined: Sun Jul 13, 2014 5:59 pm


Return to Support Forum

Who is online

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