Comments (11)
Chromium
is designed so only a single process can access a Cache
at a time. Multiple processes is not supported. If it worked previously then it was by luck, not design.
This was working with v120.1.80.
The only CefSharp
change was to upgrade to a newer CEF
version. You can easily compare tags on github v120.1.80...v120.1.110
Reproducible with CefSharp.MinimalExample since
120.1.110
(cefsharp/CefSharp.MinimalExample@136a65e).
Just launch the application twice.
The MinimalExample
isn't designed to be run multiple times. It has a fixed CachePath
.
A second launch of the application should be possible (without any restrictions).
That's not really something CefSharp
has control over. Someone should ask on chromiumembedded/cef#3615 to see if the change in behaviour is expected.
[0109/101550.289:WARNING:alloy_browser_main.cc(167)] Unhandled app relaunch; implement CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch.
We need to add IBrowserProcessHandler.OnAlreadyRunningAppRelaunch
we can use this issue to track that work.
from cefsharp.
[0109/101550.289:WARNING:alloy_browser_main.cc(167)] Unhandled app relaunch; implement CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch.
CEF thinks your application has relaunched with a CachePath
or RootCachePath
identical to another process. RequestContext
cache paths would also count.
Afaik in our main application we do not have a CachePath set (so no cache is written to the disk) and still the application is crashing. Maybe this info is relevant to you too.
Load chrome://version
in a ChromiumWebBrowser
instance within your application to see what CEF
thinks your path values are.
Again from a CefSharp
point of view the only thing that changed was an upgrade to a newer version of CEF
.
If your application doesn't have a cache set then you'll need to raise an issue at https://github.com/chromiumembedded/cef/issues as that would be an upstream bug.
from cefsharp.
Same here in our WPF application. Debug.log from v120.1.110
0110/102929.043:WARNING:alloy_browser_main.cc(167)] Unhandled app relaunch; implement CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch.
[0110/103024.131:WARNING:alloy_browser_main.cc(167)] Unhandled app relaunch; implement CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch.
[0110/103203.453:WARNING:alloy_browser_main.cc(167)] Unhandled app relaunch; implement CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch
Looks like it's related to the process singleton enabled by default and a virtual function CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch
need to be implemented, see chromiumembedded/cef#3615.
from cefsharp.
///
/// Implement this method to provide app-specific behavior when an already
/// running app is relaunched with the same CefSettings.root_cache_path value.
/// For example, activate an existing app window or create a new app window.
/// |command_line| will be read-only. Do not keep a reference to
/// |command_line| outside of this method. Return true if the relaunch is
/// handled or false for default relaunch behavior. Default behavior will
/// create a new default styled Chrome window.
///
/// To avoid cache corruption only a single app instance is allowed to run for
/// a given CefSettings.root_cache_path value. On relaunch the app checks a
/// process singleton lock and then forwards the new launch arguments to the
/// already running app process before exiting early. Client apps should
/// therefore check the CefInitialize() return value for early exit before
/// proceeding.
///
/// This method will be called on the browser process UI thread.
///
/*--cef(optional_param=current_directory)--*/
virtual bool OnAlreadyRunningAppRelaunch(
CefRefPtr<CefCommandLine> command_line,
const CefString& current_directory) {
return false;
}
On relaunch the app checks a process singleton lock and then forwards the new launch arguments to the
already running app process before exiting early. Client apps should therefore check the CefInitialize() return value for early exit before proceeding.
As per CEF API doc
(from above).
from cefsharp.
Ok, got it, thanks
Afaik in our main application we do not have a CachePath set (so no cache is written to the disk) and still the application is crashing. Maybe this info is relevant to you too.
from cefsharp.
Ok I see. There is always a root cache path:
from cefsharp.
@amaitland Is there a function to get the default root cache path?
Or a way to call native functions from them? Like GetDefaultUserDataDirectory
? See: https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_internal.h?q=GetDefaultUserDataDirectory&ss=chromium
from cefsharp.
Client apps should therefore check the CefInitialize() return value for early exit beforeproceeding.
If the second process call to Cef.Initialzie()
isn't returning a value (if it's crashing or terminating the process), then someone needs to create an issue at https://github.com/chromiumembedded/cef/issues
from cefsharp.
Looks like CEF
is causing an access violation
for the second process(CefSharp.MinimalExample.WinForms.net472.exe
) call to Cef.Initialize (CefInitialize)
Faulting application name: CefSharp.MinimalExample.WinForms.net472.exe, version: 1.0.0.0, time stamp: 0xb8fa0b28
Faulting module name: libcef.dll, version: 120.2.5.0, time stamp: 0x659c57ab
Exception code: 0x80000003
Fault offset: 0x00000000046d32e7
Faulting process ID: 0x36ac
Faulting application start time: 0x01da4b157e671427
Faulting application path: C:\projects\CefSharp.MinimalExample\CefSharp.MinimalExample.WinForms\bin.net472\Debug\net472\CefSharp.MinimalExample.WinForms.net472.exe
Faulting module path: C:\projects\CefSharp.MinimalExample\CefSharp.MinimalExample.WinForms\bin.net472\Debug\net472\x64\libcef.dll
Report ID: e5039ffe-5121-4f92-9ecf-27fccc4854c4
Faulting package full name:
Faulting package-relative application ID:
Someone will need to raise an issue at https://github.com/chromiumembedded/cef/issues
from cefsharp.
Problem reproduces with the CEF sample application, only appears to be a problem when multi threaded message loop
is used (the default in CefSharp
).
Upstream issue chromiumembedded/cef#3635
You can try integrating CEF
into your applications existing message loop to workaround the problem for now. See https://github.com/cefsharp/CefSharp/wiki/General-Usage#multithreadedmessageloop
from cefsharp.
Upstream issue chromiumembedded/cef#3635
The upstream issue has been resolved. If I'm reading the fix correctly the UI Thread
will be shutdown if the process singleton detects an already running instance. So the previous behaviour of having multiple application instances running without providing a RootCachePath
is no longer supported/possible.
- chromiumembedded/cef#3615
- Related forum discussion https://www.magpcss.org/ceforum/viewtopic.php?f=6&t=19665
Please customize CefSettings.root_cache_path for your application. Use of the default value may lead to unintended process singleton behavior
CEF
will log this message if RootCachePath
is not set, you should ensure that at a minimum you set CefSettings.RootCachePath
to a unique folder per application to avoid unwanted calls to OnAlreadyRunningAppRelaunch
.
OnAlreadyRunningAppRelaunch
can be used to achieve the same behaviour as Chromium
. (Single process instance with multiple windows within the one process).
If you need multiple instances that are entirely isolated, then you will need to specify a unique RootCachePath
for each.
from cefsharp.
Related Issues (20)
- Page white screen
- Release Notification - 122.1.x
- Visual Content fails to load after upgrading from CEF Version 119.4.30 to CEF Version 120.1.80
- After updating to v122.1.120, disabling User Agent Client Hints using command line settings has stopped working HOT 1
- Nuget - Add repository to packages HOT 4
- Release Notification - 123.0.x
- CefSharp.BrowserSubprocess.exe crash when navigate to another url when I open CefSharp.Wpf.NetCore Demo HOT 1
- Can we have NetStandard compiled version of CefSharp.OffScreen ?
- when i enable "ChromeRuntime", the ChromiumWebBrowser layouts incorrect
- WinForm - 123.0.60 disable-gpu-compositing HOT 1
- Unable to get PostData from IRequest
- Release Notification - 124.3.x HOT 3
- OnRenderProcessTerminated add errorCode and errorMessage params
- IRenderWebBrowser.OnAcceleratedPaint pass in AcceleratedPaintInfo
- Remove Alloy Bootstrap HOT 1
- 124.3.20 Dying on a specific URL HOT 1
- Cef.Initialize fails when another process is using the same CachePath setting HOT 1
- WPF - JavaScript DragEnd event not emitted HOT 1
- After upgrading cefsharp, the program cannot run two instances at the same time. HOT 1
- No longer works on 7.0 or above - Giving up
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cefsharp.