Score:0

(Selenium/.Net/Ubuntu 22.04) Randomly Connection Refuse + ChromeDriver Remote HTTP Request Time Out

do flag

Hi everyone, good day to you.

I run 1 - 4 Selenium Chrome Drivers (Chrome v110 with chromedriver for it) on Ubuntu 22.04 with dotnet (6.0) to test my website automatically during different time of day. I randomly have issue with ChromeDriver crashed: sometime it work, sometime it doesn't.

Log shows:

Connection refuse (localhost:44509)

And later (After 60 seconds? Yes)

Unhandled exception. OpenQA.Selenium.WebDriverException: The HTTP request to the remote 
WebDriver server for url http://localhost:44509/session/<longcodehere>/url timed out after 
60 seconds.

The most ridiculous part is, it happens randomly. For example, during one day, it success 2 times, and failed during the third test, for another day, it crashed all 3 times. And, if I run 3 or 4 chromedriver at the same time, some time, only one work, then the others crash, sometime, all of them work correctly, no problem.

Here is my chromedriver config:

[C#]
service.EnableVerboseLogging = false;
service.SuppressInitialDiagnosticInformation = true;
service.HideCommandPromptWindow = false;
...
options.AddArgument("--user-agent=Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25");
options.AddArgument("--window-size=1920,1080");
options.AddArgument("--no-sandbox");
options.AddArgument("--headless");
options.AddArgument("--disable-gpu");
options.AddArgument("--disable-crash-reporter");
options.AddArgument("--disable-extensions");
options.AddArgument("--disable-in-process-stack-traces");
options.AddArgument("--disable-logging");
options.AddArgument("--disable-dev-shm-usage");
options.AddArgument("--log-level=3");
options.AddArgument("--output=/dev/null");

I code my program and test it in Window, never have any problem. All problems appear when I bring it to run on Ubuntu.

I've searched through hundred pages from stack..., guthib to reddit and medium for this problem, but it seem I didn't understand something, or there is not yet an answer for my problem. There are some hints as I did read:

[1] - CPU and ram not enough -> No, my cpu with 4 chromedrivers only < 40% and ram is 15%.

[2] - Slow network -> I don't think so, or should I re consider to think so? this is a local remote request.

[3] - Firewall -> I don't have any.

[4] - Port conflict due to multiple instances running -> Nope, 100% not it.

The last thing I did not try is to set service time out to something higher (ie, 3 minutes), but why should I do that, as this is a remote request from SAME MACHINE, or even local network, it should not need more than 1 second to response.

And now I don't know what to do.

Thank you for spent time reading my problem. Someone please save me out of this hell, it's been 3 days since my last good-night (x_x), thank you life saver!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.