I have found a workaround for this problem. This isn't really an issue during browser creation, it occurs even when no browser is being created, so it's CEF initialization problem. This issue appears more often when application is heavy overloaded during startup. CEF initialization failures can be resolved by offloading CPU after Initialize() was called. CEF is still running some stuff in its thread after CefInitialize returned, such as launching GPU process. If application is under heavy load during that initialization, it results in some race condition in CEF that ends with segmentation fault. The solution is to sleep application for half a second after Initialize. I have performed thousands of app launching tests and segmentation faults completely disappeared after adding the sleep call. Without that sleep it was reproducible on average every 100 runs. In CEF Python the solution was to add such code:
- Code: Select all
cefpython.Initialize()
if platform.system() == "Linux":
time.sleep(0.5)
This initialization failure issue was observed in CEF branches 1650 and 1750, on both Linux and OSX. It was reproducible in both CEF Python and CEF2go projects. In CEF tracker there is Issue 1207 to provide script for stress testing application launch. It would be nice if these race conditions were fixed in CEF.