Java code that initialize cefApp and create client:
- Code: Select all
private void initializeBrowserComponents(String startURL, CefLoadHandlerAdapter cefLoadHandlerAdapter) throws Exception {
startCefAppIfNeeded();
cefApp = createCefAppInstance();
client = createCefClient(cefLoadHandlerAdapter);
log.debug("Creating CefBrowser with start URL: {}", startURL);
browser = client.createBrowser(startURL, false, false);
}
private void startCefAppIfNeeded() throws Exception {
if (!cefAppLoaded) {
cefAppLoaded = CefApp.startup(new String[]{});
if (!cefAppLoaded) {
throw new Exception("Browser failed to start");
}
}
}
private void startCefAppIfNeeded() throws Exception {
if (!cefAppLoaded) {
cefAppLoaded = CefApp.startup(new String[]{});
if (!cefAppLoaded) {
String browserFailedToStartMessage = "Browser failed to start";
log.error(browserFailedToStartMessage);
throw new Exception(browserFailedToStartMessage);
}
}
}
private CefApp createCefAppInstance() {
String[] arguments = {"--disable-shared-workers", "--enable-crash-reporter", "--full-memory-crash-report"};
if (CefApp.getState() == CefApp.CefAppState.NONE) {
CefSettings settings = new CefSettings();
settings.windowless_rendering_enabled = false;
settings.log_file = logsPath;
settings.log_severity = LogSeverity.LOGSEVERITY_VERBOSE;
return CefApp.getInstance(arguments, settings);
} else {
return CefApp.getInstance(arguments);
}
}
private CefClient createCefClient(CefLoadHandlerAdapter cefLoadHandlerAdapter) {
try {
CefClient cefClient = cefApp.createClient();
cefClient.addLoadHandler(cefLoadHandlerAdapter);
return cefClient;
} catch (Exception e) {
log.error("Problem with creating CefClient", e);
throw e;
}
}
Normally error occurs very rarely and indeterministically, but if I attach remote debugger and step over CefAppHandlerAdapter::onBeforeCommandLineProcessing or some next methods called during creating of cefApp client JVM crashes almost always.
I set logs severity to verbose but there are no info there.
I've tried to use switches from https://peter.sh/experiments/chromium-c ... -switches/ especially --disable-dev-shm-usage, --no-sandbox, --disable-shared-workers but with no effect.
Does anyone know what's the problem?