[🐛 Bug]: Unable to find a free port starting selenium server 4.5.2 on linux
What happened?
Caused by: java.lang.RuntimeException: Unable to find a free port at org.openqa.selenium.net.PortProber.findFreePort(PortProber.java:64) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:433) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:128) at org.openqa.selenium.chrome.ChromeDriverInfo.isAvailable(ChromeDriverInfo.java:67) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) at java.util.Iterator.forEachRemaining(Iterator.java:116) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) at org.openqa.selenium.grid.node.config.NodeOptions.discoverDrivers(NodeOptions.java:509) at org.openqa.selenium.grid.node.config.NodeOptions.getSessionFactories(NodeOptions.java:205) at org.openqa.selenium.grid.node.local.LocalNodeFactory.create(LocalNodeFactory.java:80) ... 22 more
How can we reproduce the issue?
Launch selenium server on linux
Relevant log output
.
Operating System
Linux
Selenium version
4.5.2
What are the browser(s) and version(s) where you see this issue?
Chrome
What are the browser driver(s) and version(s) where you see this issue?
chromedriver v106
Are you using Selenium Grid?
4.5.2
@vicozohili, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template label.
If the issue is a question, add the I-question label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-* label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer label.
Thank you!
This happened to me also, running a non-grid chrome driver on circleCI, Linux
this is the stack trace:
Caused by: java.lang.RuntimeException: Unable to find a free port
at org.openqa.selenium.net.PortProber.findFreePort(PortProber.java:64)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:433)
at org.openqa.selenium.chrome.ChromeDriverService.createServiceWithConfig(ChromeDriverService.java:142)
at org.openqa.selenium.chrome.ChromeDriver.
might be related to: https://github.com/SeleniumHQ/selenium/commit/2eb3a0e4e9724297f362f2bb7b76155a10ab7444
or: https://github.com/SeleniumHQ/selenium/commit/baedf6b16b6a0a0b410a7056c853a5fa1fbe006c
@pujagani @diemol
Have the same problem since friday
Same issue on v4.5.1 and v4.5.2. All works fine on v4.5.0. Using on Linux (Ubuntu). Potentially related to this change: https://github.com/SeleniumHQ/selenium/pull/11085/files#diff-8b05a1bfd55e4e3b96646952fb16845057f9b8abeab5c2bd986ca7fa2010cd1bR108
Are you all having the issue only on Linux? Are you running the Grid in a containerized environment?
only on Linux (Ubuntu) -> Docker Container. Locally on the windows machine the test are running fine
@diemol my automation runs on Linux (Ubuntu) -> Docker Container on CircleCI. on Mac, i have no issues.
OK, let me revert that change and avoid checks for Linux .
I encountered the same issue when running in Travis CI with docker service. At first I upgraded to 4.5.0 and everything was working okay then since about Friday I started seeing the Unable to find a free port exception. I then tried both 4.3.0 and 4.5.2 but saw the same issue.
I was able to work around this issue by adding the environment variable SE_DOCKER as true to my CI and running with version 4.5.2 which is expecting that env var in this commit. After that everything started working as before.
I am reverting this change and avoiding the check for Linux, also the SE_DOCKER env var will be removed.
I will do a 4.5.3 release in the afternoon.
Seeing the same on 4.5.2, Mac Big Sur using WebDriver: org.openqa.selenium.net.PortProber#checkPortIsFree() - isFree("::1", port) returns false
I updated to 4.5.3, still the same problem in ci / docker, any idea how to fix it? thx!
I did not get any errors in the Docker CI pipeline, which error are you getting? How are you starting the Grid?
I use the bonigarcia/webdrivermanager to setup and start the driver in combination with selenide framework
Here is the exception:
Unable to find a free port
java.lang.RuntimeException: Unable to find a free port
at org.openqa.selenium.net.PortProber.findFreePort(PortProber.java:64)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:433)
at org.openqa.selenium.chrome.ChromeDriverService.createServiceWithConfig(ChromeDriverService.java:142)
at org.openqa.selenium.chrome.ChromeDriver.
I did not get any errors in the Docker CI pipeline, which error are you getting? How are you starting the Grid?
I start the grid using the following in a linux environment
java -jar selenium-server-4.5.0.jar hub java -Dwebdriver.chrome.driver=chromedriver -Dwebdriver.chrome.whitelistedIps= -jar selenium-server-4.5.0.jar node
I did not get any errors in the Docker CI pipeline, which error are you getting? How are you starting the Grid?
I start the grid using the following in a linux environment
java -jar selenium-server-4.5.0.jar hub java -Dwebdriver.chrome.driver=chromedriver -Dwebdriver.chrome.whitelistedIps= -jar selenium-server-4.5.0.jar node
Are you getting this with 4.5.3?
I use the bonigarcia/webdrivermanager to setup and start the driver in combination with selenide framework
Here is the exception:
Unable to find a free port
java.lang.RuntimeException: Unable to find a free port at org.openqa.selenium.net.PortProber.findFreePort(PortProber.java:64) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:433) at org.openqa.selenium.chrome.ChromeDriverService.createServiceWithConfig(ChromeDriverService.java:142) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:70) at commons.WebDriverUtils.createDriver(WebDriverUtils.java:136)
@wsieb would need to see a clear way to reproduce this, please
updated the chrome & chromedriver to the newest version (106), seems to work now, thx for the help and sorry for the confusion
@diemol issue is now fixed with 4.5.3 and is now able to launch the grid, however, it fails to launch chrome v107. reverting to 4.5.0 which has no issue for now.