Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium WebDriver exception when multiple processes run in parallel

I have a process, using Selenium Web driver for Firefox, for automatic look up for information on one specific site. Due to the volume of the data being looked up, I am running in parallel several copies of this process. Sometimes they are ok, sometimes I get an exception, which I do not understand the cause for. The Process is written in C#, runs on Windows. Each process creates its own instance of Selenium, FF web driver, I see each process has a separate FireFox process. No multi-treading (inside one process). I do not understand what exactly is the issue. Could not find any documentation that could tell me more. If anyone has an idea, I'd appreciate any info/suggestions

The exception is:

"OpenQA.Selenium.WebDriverException: Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted 127.0.0.1:7056"

I can not see what can be trying to make more than one "usage" of the socket address in one given process. And from the logs I see that the different processes use different ports ( the "7056" above is a different number in each process).

Thank you in advace

like image 936
Mravek Avatar asked Jan 18 '26 19:01

Mravek


1 Answers

I recently ran into this and found a pretty interesting article about fine tuning your network settings.

https://blogs.msdn.microsoft.com/dgorti/2005/09/18/only-one-usage-of-each-socket-address-protocolnetwork-addressport-is-normally-permitted/

so pretty much if you run a high degree of parallelism in your tests with not enough ports open and a high timeout you will run out of sockets and this will happen. either increase the ports, reduce the wait time and check what can be leaving your instances hanging.

like image 182
Chazz Briseño Avatar answered Jan 20 '26 08:01

Chazz Briseño