Is it possible to change CEF / Chromium's crashing behavior?

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.

Is it possible to change CEF / Chromium's crashing behavior?

Postby hyzerfool » Fri Nov 01, 2024 8:58 am

CEF / Chromium are aggressive about crashing when there's a problem. Fundamentally, I agree with that, but there are cases for us where we'd really like to avoid it.

In our app, the browsers are used to have views on data. So if a particular browser crashes we can handle that, but the problem is it crashes our entire application. 2 places that come to mind are:

1) Timeouts. The one I played around with was kConnectionTimeout in frame_impl.cc. We used to hit this reasonably often, though since the default has been changed from 4 seconds to 10 it's less frequent.

2) Out of memory.

Obviously Out of Memory is very different from Timeouts, but I'd love it if we could find a way to contain the damage to the browser and close the browser and let our overall app try to recover.

Is there a way to tell CEF to just crash the browser? Or possibly even all CEF browsers? But not our entire app?

I see in OnNoMemoryInternal where it specifically calls _exit(). There is PartitionBucket::AllocNewSuperPageSpan which has AllocFlags and it checks for kReturnNull as a potential way in, but the comments suggest that crashing is the way it's designed and possibly not easy to get around (from OnNoMemoryInternal in oom.cc)
// Kill the process. This is important for security since most of code
// does not check the result of memory allocation.

It does throw win::kOomExceptionCode before calling _exit, though I'm not sure whether that's an opportunity for me or not.

The out of memory I'm seeing now is in Chrome_IOThread

I'm not optimistic, but figured it's at least worth asking.
hyzerfool
Techie
 
Posts: 35
Joined: Wed May 13, 2015 2:37 pm

Re: Is it possible to change CEF / Chromium's crashing behav

Postby magreenblatt » Fri Nov 01, 2024 9:37 am

Run CEF in a separate process. Restart it if it crashes.
magreenblatt
Site Admin
 
Posts: 12807
Joined: Fri May 29, 2009 6:57 pm

Re: Is it possible to change CEF / Chromium's crashing behav

Postby hyzerfool » Mon Nov 04, 2024 9:39 am

It had never occurred to me that we could move our browser handling etc into its own process. Love the suggestion. Will now commence to learning how to do it.

thanks,

doug
hyzerfool
Techie
 
Posts: 35
Joined: Wed May 13, 2015 2:37 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 23 guests