[🐛 Bug]: Unable to find a free port starting selenium server 4.5.2 on linux
See original GitHub issueWhat 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
Issue Analytics
- State:
- Created a year ago
- Comments:21 (9 by maintainers)

Top Related StackOverflow Question
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.0and everything was working okay then since about Friday I started seeing theUnable to find a free portexception. I then tried both4.3.0and4.5.2but saw the same issue.I was able to work around this issue by adding the environment variable
SE_DOCKERastrueto my CI and running with version4.5.2which is expecting that env var in this commit. After that everything started working as before.