Zombie Chrome process after creating failed for chromedriver
See original GitHub issueš Bug Report
When creating a new Driver using the C# bindings on windows (Specifically in this case Chrome) when initialization fails, a chrome process is created without a chromedriver process.
The error is
OpenQA.Selenium.WebDriverException: unknown error: failed to wait for extension background page to load
To Reproduce
The error happens when I am running 40-50 chromedrivers in parallel. It doesnt happen if I use small number of chromedrivers like 5 or 10. The more chromedrivers I use, the faster that error happens.
Detailed steps to reproduce the behavior:
Expected behavior
The chrome process is not created when creating chromedriver failed
Environment
OS: Windows 10 Browser: Chrome Browser version: 77.0.3865.75 Browser Driver version: ChromeDriver 77.0.3865.40 Language Bindings version: C# 4.0.30319 Selenium Grid version (if applicable): No
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
This is nothing new and I think you expectation is wrong - - if my assumptions are false, I preemptively say sorry.
Chrome itself is a different piece of software, itās not part of Selenium, not even of the Chromedriver. When u start execution of code āout of the scopeā (in this moment: Chromedriver triggering the start of the Chrome process) and the calling part fails, thereās no way to jump back into the external code - so the only way would be to forcefully kill the chrome process - which would also not meeting your expectations as the the process is created when chromedriver is triggering it š
Init fail does (as everywhere) disconnect chromedriver from chrome. Unless the Chrome devs include something like a timeout when chrome is triggered by Chromedriver or include a reconnect during the (short) start (doubt that u can restart a failed chromedriver init so quick, that you are able to reconnect BEFORE chrome is opened).
I had problems with such zombie chromes a along time. My solution in the end:
Whenever I start a chromedriver, I let my application scan for chrome.exe with their property StartTime > the startTime of Chromedriver. I store the PID of that process. No matter if it fails or goes through, I can always sure and quickly identify the zombie and get rid of it with a simple
GetProcessById(pid).Kill()
That way i can keep my automation going on for weeks, never running into serious issues due to zombie processes etc.
Above all: think itās not even a Selenium problem - if even itās a Chromedriver thing (which is not developed by Selenium developers. But I think more itās a general problem based on the fact that weāre talking here about 3 different products that hook into each other / communicate and being developed independently from each other. The term mostly used for this is āflakynessā. Such init issues etc. - well - such flakyness youāll also find on test frameworks where the majority is being developed by companies.
And btw: 40-50 on a single systsem is not a good idea, flakyness becomes more extreme. Better move some to another box or simply run more tests in sucession than paralalel.
Keep in mind, Selenium is made for Application Testing, not really for huge aautomation / scraping tasks (even I use it heavily for thata - but iām using it distributed, never more than 10-15 on same machine - depending on the actualy system, sometimes even just 5-7.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.