Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Multiple executables using the same session and login

Post Reply
felipe
Posts: 3
Joined: Wed Mar 12, 2025 12:29 pm

Multiple executables using the same session and login

Post by felipe »

Hello my friend !

I'm developing an application which needs to be looged using the same session and cookies.

Is it possible to use multiple executables on the same cache folder ? I was using the libcef 90.5 version through UserDataPath property to keep the same session, but in the 133.4 version this property was deprecated.

Is there another option which has the same function ? Or another method to keep this running ?

I really appreciate your attention !
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Multiple executables using the same session and login

Post by salvadordf »

Hi,

CEF changed the way it initializes and now it checks if another app is running with the same RootCache setting.

Read this answer :
https://stackoverflow.com/questions/78652092/cef4delphi-application-cant-run-two-instances/78652679#78652679

The TabbedBrowser2 demo has all the code needed to implement the GlobalCEFApp.OnAlreadyRunningAppRelaunch event :
https://github.com/salvadordf/CEF4Delphi/blob/752306b7c964652b9a1ac273adc1aecc46aa1842/demos/Delphi_VCL/TabbedBrowser2/uMainForm.pas#L155
felipe
Posts: 3
Joined: Wed Mar 12, 2025 12:29 pm

Re: Multiple executables using the same session and login

Post by felipe »

So, is it not possible to use multiple instances in the same root cache folder anymore ?

The post indicates that multiple application instances writing to the same RootCache directory could result in data corruption, but, is there any possibility to keep my application writing in the same folder ? For us, it's very important to keep running multiples instances on the same directory.

I really appreciate your attention Salvador !
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Multiple executables using the same session and login

Post by salvadordf »

Hi,

Having multiple app instances with the same RootCache or cache directories was never safe and the CEF project maintainer decided to check if some other application was using that directory during the CEF initialization.

You can run multiple instances of your application with a different RootCache directory but then you can't share cookies.

The recommended solution is to implement GlobalCEFApp.OnAlreadyRunningAppRelaunch and open a new tab or child window in the main application when a second app instance is detected, as you can see in the TabbedBrowser2 demo.

See the code comments for GlobalCEFApp.OnAlreadyRunningAppRelaunch, GlobalCEFApp.RootCache and GlobalCEFApp.Cache.

I'm not aware of any setting to initialize CEF with the same RootCache directory in read-only mode.
felipe
Posts: 3
Joined: Wed Mar 12, 2025 12:29 pm

Re: Multiple executables using the same session and login

Post by felipe »

Ok, i got Salvador !

Thank you for your help !
Post Reply