hardkoded / puppeteer-sharp

Headless Chrome .NET API
https://www.puppeteersharp.com
MIT License
3.3k stars 439 forks source link

Occasional unable to launch chromium errors #1469

Closed Telavian closed 3 years ago

Telavian commented 4 years ago

Description

I am using MS Edge 81.0.416.68 in Win 10 and I sporadically see issues when attempting to load a new browser. It also seems in this case that the browser hangs around and doesn't get killed.

Not sure how to get more information or where to look for more information actually. It might have something to do with high amounts of browsers being created or high load. I am investigating further.

Are there any load test type projects currently using puppeteer-sharp?

PuppeteerSharp.ChromiumProcessException: Failed to launch Chromium! [0506/185549.879:ERROR:session_end_watcher.cc(141)] RegisterClass: The requested lookup key was not found in any active activation context. (0x36B7)
[0506/185549.885:ERROR:crashpad.cc(146)] Failed to get activation factory for IPlatformDiagnosticsAndUsageDataSettingsStatics
[0506/185549.906:ERROR:message_window.cc(61)] Failed to register the window class for a message-only window: The operation completed successfully. (0x0)
[0506/185549.907:ERROR:message_window.cc(133)] Failed to create a message-only window: The parameter is incorrect. (0x57)
[0506/185549.915:ERROR:message_window.cc(133)] Failed to create a message-only window: The parameter is incorrect. (0x57)

   at PuppeteerSharp.ChromiumProcess.State.StartingState.StartCoreAsync(ChromiumProcess p)
   at PuppeteerSharp.ChromiumProcess.State.StartingState.StartCoreAsync(ChromiumProcess p)
   at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options)
   at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options)
kblok commented 3 years ago

Closed due to inactivity. Feel free to reopen it if needed.

Telavian commented 2 years ago

If I remember correctly then I think I needed to have less browser instances running per process. I think it was better to have 2 processes with fewer browsers than 1 with more. Running slightly below is better than slightly above.

Headless browsers have been a huge ordeal for us and we have tried puppeteer, playwright, selenium, and cefsharp. With firefox, edge, and chrome. Each has advantages when compared individually.

However by far the best choice has been cefsharp. It is slower but it has been significantly more stable for us. I was going to investigate webview2 however will likely not do that for a while.

I also needed to create a single browser instance at a time however I honestly don't remember why now.

            using (await _creationLock.LockAsync())
            { 
                // CreateBrowser
            }