Page 1 of 1

When the renderer process terminates abnormally

PostPosted: Thu Jun 20, 2019 9:15 pm
by banggi
Hi, first i apologize for my English skill.

I would like to be tested for one simple fix. This is the situation after the renderer process terminated abnormally.
Reference file : cef/libcef/browser/browser_host_impl.cc

My project is matched with one gl surface per renderer process. It is also an embedded environment.
So to destroy one surface, Browser call API(brower->GetHost()->CloseBrowser(true)) through IPC message from the system.

In normal case, there was no problem at all. because browser call the `CloseBrowser` API. However, in an abnormal termination situation, the surface is not terminated.
because platform_delegate_.reset(NULL) which is a process within the CefBrowserHostImpl::DestroyBrowser(), is not called.
In addition, the resources associated with the renderer process seem to be not released.

While i was looking for a way, I notice that CefBrowserHostImpl::RenderProcessGone is called when the renderer process terminates abnormally.
So i inserted the following code to destroy the resources and surfaces associated with the renderer process when the function is called.

Code: Select all
void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
 
  ...
 
  if (client_.get()) {
    CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
    if (handler.get()) {
      std::unique_ptr<NavigationLock> navigation_lock = CreateNavigationLock();
      handler->OnRenderProcessTerminated(this, ts);
      CEF_POST_TASK(CEF_UIT,
          base::Bind(&CefBrowserHostImpl::CloseBrowser, this, true));
    }
  }
}


Is this code likely to cause other problems?

Re: When the renderer process terminates abnormally

PostPosted: Thu Jun 20, 2019 11:39 pm
by magreenblatt
If your intention is to close the browser when the render process terminates, then you should implement OnRenderProcessTerminated in your client and call CloseBrowser from there instead of changing libcef.

Re: When the renderer process terminates abnormally

PostPosted: Fri Jun 21, 2019 12:12 am
by banggi
Thank you for your response :)