0

I am upgrading my application from CefSharp 53 to the current CefSharp 73. (I know, super behind). I specifically use the CefSharp.OffScreen.ChromiumWebBrowser and one thing I noticed is there are now two CefSharp.BrowserSubprocess.exe processes that start (on Windows 10, x64). When dispose is called, one of the two processes closes leaving the other open.

Is this expected? With version 53 it just fired up one process and closed it upon calling dispose. If it helps I am using cefsharp to create a screenshot, so after the page loads, I call ScreenShotOrNull().

Edit: Some code context:

I am starting cefsharp at windows service start:

static void Main(string[] args)
{
        var settings = var settings = new CefSettings
        {
            LogSeverity = LogSeverity.Warning
        };
        settings.CefCommandLineArgs.Add("disable-gpu", "1");
        settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
        CefSharpSettings.LegacyJavascriptBindingEnabled = true;
        Cef.Initialize(settings);
 }

At this point no browser is being instantiated and thus, no processes. However, when needed I will call:

 using (_browser = new ChromiumWebBrowser(url) { Size = new 
 Size(width, 720) })
 {
      // At this point, there are two processes
      // Code waiting for browser to finish loading
      using(var bitmap = _browser.ScreenshotOrNull())
      {
          // Code for saving
      }
 }

After it finishes, there is only one process, with the following command line parameters:

--type=gpu-process
--field-trial-handle=2968,16124456567459120137,1231289933363561479,131072
--disable-features=VizDisplayCompositor
--no-sandbox
--disable-gpu-vsync=1
--log-file="log.txt"
--log-severity=warning
--lang=en-US    --cefsharpexitsub
--gpu-preferences=AGiantStringThatWontDisplayHereCorrectly
--use-gl=swiftshader-webgl
--log-file="debug.log"
--service-request-channel-token=13307567583052100413
--mojo-platform-channel-handle=3016
/prefetch:2
 --host-process-id=7444  10428
  • See https://github.com/cefsharp/CefSharp/wiki/General-Usage#processes it's likely the gpu process, look in task manager at the command line args there will be a type param – amaitland Jun 06 '19 at 20:29
  • @amaitland You're right, it is the GPU process. I'm running this on a server and i passed in the disable gpu flags. Is that still expected? – Peter Zimmerman Jun 13 '19 at 14:09
  • How did you pass in the command line arg? – amaitland Jun 13 '19 at 19:40
  • settings.CefCommandLineArgs.Add("disable-gpu", "1"); settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); – Peter Zimmerman Jun 14 '19 at 00:04
  • If it worked previously then it's probably correct, It's also possible your `GPU` wasn't previously supported, and you aren't correctly applying the command line args. Two lines out of context really doesn't tell me anything. You should be able to confirm in Task manager that the command line arg is being applied to the – amaitland Jun 14 '19 at 00:20
  • @amaitland I added more code to my original post – Peter Zimmerman Jun 14 '19 at 00:44
  • Try removing `disable-gpu-vsync`, you shouldn't need to disable `Vsync` if the `GPU` is already disabled, and it's possible that **Chromium** is ignoring the disable gpu with it present. – amaitland Jun 14 '19 at 01:31
  • A quick test with `cefclient --disable-gpu` and it's launching the `GPU` process. You'll have to ask on https://magpcss.org/ceforum/index.php to see if this is a bug in `CEF` or `Chromium`. See https://github.com/cefsharp/CefSharp/blob/master/CONTRIBUTING.md#cefsharp-vs-chromium-embedded-frameworkcef for background – amaitland Jun 14 '19 at 01:40
  • Unfortunately I don't have the time at the moment to wait for a bug fix for that. Instead I opted to get rid of all the **disable-gpu** arguments and use **in-process-gpu** so at least 2 processes don't get spawned everytime. It seems to be working so far with my initial tests. I appreciate the help. I think the official answer to the question "is it normal for two processes to start" is yes. – Peter Zimmerman Jun 17 '19 at 13:16

0 Answers0