Error with cache with two instances of CEF C++ application

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Error with cache with two instances of CEF C++ application

Postby afgarcia » Mon Oct 30, 2023 9:51 am

Hello,

I have a CEF C++ application in Debian that launches with an external event and loads a web content that uses the browser local storage to read and write some data.

The problem comes when one instance of the application is running and other instance loads in the back and need to access this data, there are quite a few seconds where the browser content is black, the error I get is the next one:

[1027/122920.357660:WARNING:value_store_frontend.cc(44)] Reading mhjfbmdgcfjbbpaeojofohoefgiehjai.alarms from failed: IO error: .../LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)

When launching the app, I always set the cache directory to the same one for sharing data between the different processes and I always initialize CEF too.

Is there a way to share cache between processes without getting this concurrency error? Or maybe, checking if CEF is already initialized on the system in order to just launch a new window?

Thanks.
afgarcia
Newbie
 
Posts: 3
Joined: Mon Oct 30, 2023 3:53 am

Re: Error with cache with two instances of CEF C++ applicati

Postby magreenblatt » Mon Oct 30, 2023 10:42 am

Is there a way to share cache between processes without getting this concurrency error?

No, each main process instance requires its own cache.

Or maybe, checking if CEF is already initialized on the system in order to just launch a new window?

Yes, you can implement this approach in your application. See https://stackoverflow.com/questions/533 ... -in-c-or-c
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Error with cache with two instances of CEF C++ applicati

Postby afgarcia » Tue Oct 31, 2023 6:09 am

Thanks for your reply,

I have a few questions with the approach you propossed. I understand the cache path to the new app instance is set to each CefInitialize process. Is the main process instance indicated on the running processes list as this?

user 3740 0.0 0.0 8704 884 ? S 11:18 0:00 /opt/Browser/chrome-sandbox


How could I set the cache path to the new app instance without doing the CefInitialize, so I can just create a new browser window?

I also saw that there is a function "CefCurrentlyOn()" that you could pass the variable "TID_UI" in order to check if cef is already running, does this still work, or its deprecated and now it uses "CEF_REQUIRE_UI_THREAD();"?

Thanks for your answers.
afgarcia
Newbie
 
Posts: 3
Joined: Mon Oct 30, 2023 3:53 am

Re: Error with cache with two instances of CEF C++ applicati

Postby KatrinaS » Tue Oct 31, 2023 10:25 am

I don't think you can (but I may be wrong), access to the Database / Folder(s) is locked, possibly to an instance. I detect instances of the helper.exe to find out if CEF is already running :)
KatrinaS
Mentor
 
Posts: 83
Joined: Tue Jul 04, 2023 6:30 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 183 guests