-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[🐛 Bug]: Port collision on linux causing chromedriver to crash #10974
Comments
@h-arlt, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
@h-arlt Do you have a vision how to fix this issue? I see one strange thing about this commit:
|
@asolntsev I completely agree with your findings/notes about this commit; it mixes up several things w/o any further explanation why those changes were made. We did never experience any issues regarding port collision in Selenium 3 but are faced with such issues in Selenium 4 at least once a day. |
@oomelianchuk ooc, is neodymium active? have you added it to our list? https://docs.google.com/forms/d/e/1FAIpQLSdr21sc1j8a4yqq-TQnc6ATC4r7she2CuSSfZylvC_YOX3JFA/viewform |
@asolntsev @h-arlt would you like to send a PR for this? We can review that together with @shs96c. |
…crash - let port prober choose from a safe range of ephemeral ports that explicitly exclude the well-known range of ephemeral ports used by the OS for port allocation (as was done in Selenium v3) - keep fallback to IANA port range in case range of ephemeral ports is too low (less than 5k)
Let port prober choose from a safe range of ephemeral ports that explicitly exclude the well-known range of ephemeral ports used by the OS for port allocation as was done in Selenium v3. Keep fallback to IANA port range in case range of ephemeral ports is too low (less than 5k). Fixes SeleniumHQ#10974
@diemol Feel free to take a look and adapt the code as necessary. As stated in the PR, I wasn't able to build Selenium Java and run the existing tests as the build process ate all of my free disk space 🤷 |
@h-arlt you can also use GitPod and try out the build there |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What happened?
In Selenium v3, port probing choosed from a safe range of ephemeral ports that explicitly excluded the well-known range of ephemeral ports used by the OS for port allocation. See also the JavaDoc of PortProber.java in Selenium v3.141.49:
Since Selenium v4, moreover since commit 294d1c9, this behavior has changed as range of ports to choose from is now the well-known range of ephemeral ports used by the OS. IMO this is not correct as the well-known range of ephemeral ports should be used for short-living connections only; the connection to the browser driver server is far away from being short-living.
Anyway, this change increases the probability to choose a port that is already used, e.g. a connection established by some other browser process.
Moreover, the port is not detected as already being used since the port is bound to another interface than the loopback device that is used by PortProber (method
checkPortIsFree
useslocalhost
which resolves to IP127.0.0.1
- the IP of the loopback device)You might say that the probability is quite low, so what. Well, we are using Selenium/WebDriver in our self-hosted monitoring solution that executes real-browser tests regularly. One of our customers execute tests every minute and we're faced with chromedriver crashes at least once a day due to port collisions since we upgraded to Selenium v4.
How can we reproduce the issue?
Relevant log output
The text was updated successfully, but these errors were encountered: