cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.76k stars 2.92k forks source link

Cef.Initialize fails when another process is using the same CachePath setting #4799

Closed lukaszm closed 2 months ago

lukaszm commented 2 months ago

Is there an existing issue for this?

CefSharp Version

124.3.20

Operating System

Windows 10

Architecture

x64

.Net Version

.Net 6.0

Implementation

WPF

Reproduction Steps

CefSharpCacheTest.zip

Build the attached project, run 2 instances of the application. In the first window set cache options, then click Initialize CEF. In the second window, set the options to the same values and click Initialize CEF.

Expected behavior

Cef should initialize in both instances.

Actual behavior

First instance intitializes correctly (RESULT: True, Cef.IsInitialized: True), but in the second instance initialization fails (RESULT: False, Cef.IsInitialized: False) and if you click the button to try initializing again, the application crashes.

As a result, it is impossible for 2 instances of the application to share the same CachePath (also applies to the memory cache used when CachePath == null).

Regression?

Works fine with CefSharp versions < 120.1.80 With versions < 121.3.70 the second instance crashes on first CEF initialization attempt. From 121.3.70 on, the behavior is as described above (first initialization returns False, second crashes).

Known Workarounds

Use different CachePath setting when initializing CEF instances.

Does this problem also occur in the CEF Sample Application

No

Other information

log file doesn't contain any relevant info

amaitland commented 2 months ago

CEF now supports the Chromium process singleton, this brings with it changes to how CachePath/RootCachePath are accessed from multiple processes. See https://github.com/cefsharp/CefSharp/issues/4668 for more details

What you are seeing is the expected behaviour.