Page 1 of 1

Sandbox Issue When Launching MiniBrowser Twice with CEF 126

Posted: Wed Aug 07, 2024 12:31 pm
by patrick.rohrbacher
Hello,

I am encountering an issue related to the Chromium Embedded Framework (CEF 126) while using the MiniBrowser demo application. When I launch the MiniBrowser twice, the Chromium processes start with the following message:
--no-sandbox stability and security will suffer

How can we avoid this problem?

How can we make it possible for two processes to be launched simultaneously?

Re: Sandbox Issue When Launching MiniBrowser Twice with CEF 126

Posted: Wed Aug 07, 2024 12:42 pm
by salvadordf
Hi,

Read the information in these links about the limitations when we try to launch several instances of the same application with a CEF browser :
https://www.briskbard.com/forum/viewtopic.php?t=2208
https://stackoverflow.com/questions/78652092/cef4delphi-application-cant-run-two-instances

It's not possible to enable the sandbox in Delphi applications.

Re: Sandbox Issue When Launching MiniBrowser Twice with CEF 126

Posted: Wed Aug 07, 2024 1:06 pm
by patrick.rohrbacher
Okay, thanks for the response. Here is the solution I implemented, which allows me to have the same cache or less when I run the application only once

function getCacheName(const prefix: String = 'cache'): String;
var
i: Integer;
sDir: String;
begin
sDir:= ExtractFileDir(ParamStr(0));
sDir:= IncludeTrailingPathDelimiter(sDir);
for i:= 1 to 100 do begin
result:= prefix + i.ToString;
if not(FileExists(IncludeTrailingPathDelimiter(sDir + result) + 'lockfile')) then exit;
end;
end;



procedure CreateGlobalCEFApp;
begin
GlobalCEFApp:= TCefApplication.Create;
GlobalCEFApp.cache:= getCacheName();
GlobalCEFApp.EnablePrintPreview:= True;
GlobalCEFApp.EnableGPU:= True;
GlobalCEFApp.LogFile:= 'debug.log';
GlobalCEFApp.LogSeverity:= LOGSEVERITY_INFO;
GlobalCEFApp.UncaughtExceptionStackSize:= 50;
GlobalCEFApp.OnUncaughtException:= GlobalCEFApp_OnUncaughtException;
GlobalCEFApp.ChromeRuntime:= True;
end;