chromiumembedded / java-cef

Java Chromium Embedded Framework (JCEF). A simple framework for embedding Chromium-based browsers in other applications using the Java programming language.
https://bitbucket.org/chromiumembedded/java-cef
Other
662 stars 148 forks source link

Cannot start more than one browser processus since CEF 121 #484

Open apique13 opened 2 months ago

apique13 commented 2 months ago

Describe the bug Cannot start more than one browser processus since CEF 121 (https://github.com/cefsharp/CefSharp/issues/4668) I understood it is because of the CefSettings.root_cache_path parameter, but what is the good solution to manage it ? The only workaround possible should be to define a random root_cache_path for each instance, but it is a bit dirty.

To Reproduce Launch run.bat to start the demo browser. Launch it twice, The second browser will hang.

Expected behavior A clear and concise description of what you expected to happen and what happened instead.

Screenshots image

Versions (please complete the following information):

Logs java -cp "./bin;./bin/*" -Djava.library.path=./bin/lib/win64 tests.detailed.MainFrame Offscreen rendering disabled Using: JCEF Version = 127.3.1.329 CEF Version = 127.3.1 Chromium Version = 127.0.6533.100 AppHandler.stateHasChanged: INITIALIZING initialize on Thread[AWT-EventQueue-0,6,main] with library path ./bin/lib/win64 [0927/184404.913:WARNING:alloy_main_delegate.cc(559)] Alloy bootstrap is deprecated and will be removed in ~M127. See https://github.com/chromiumembedded/cef/issues/3685 Added scheme search:// Added scheme client:// [0927/184404.917:WARNING:resource_util.cc(99)] Please customize CefSettings.root_cache_path for your application. Use of the default value may lead to unintended process singleton behavior. Opening in existing browser session. AppHandler.stateHasChanged: INITIALIZATION_FAILED [0927/184404.934:WARNING:task_impl.cc(19)] No task runner for threadId 0 [0927/184404.935:WARNING:task_impl.cc(31)] No task runner for threadId 0 [0927/184404.935:WARNING:task_impl.cc(19)] No task runner for threadId 0 [0927/184404.935:WARNING:task_impl.cc(31)] No task runner for threadId 0 [0927/184405.253:WARNING:task_impl.cc(19)] No task runner for threadId 0 [0927/184405.253:WARNING:task_impl.cc(31)] No task runner for threadId 0 [0927/184405.357:WARNING:task_impl.cc(19)] No task runner for threadId 0 [0927/184405.360:WARNING:task_impl.cc(31)] No task runner for threadId 0 [0927/184405.463:WARNING:task_impl.cc(19)] No task runner for threadId 0 [0927/184405.463:WARNING:task_impl.cc(31)] No task runner for threadId 0 [0927/184405.569:WARNING:task_impl.cc(19)] No task runner for threadId 0

nrmnrm commented 2 months ago

This is actually expected behaviour, each browser process needs its own root cache folder now, use something like this:

CefSettings settings = new CefSettings(); Path tmpDir = Files.createTempDirectory("dc-"); tmpDir.toFile().deleteOnExit(); settings.root_cache_path = tmpDir.toString();