selenium: [🐛 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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (9 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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

Have the same problem since friday

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.<init>(ChromeDriver.java:70)

might be related to: https://github.com/SeleniumHQ/selenium/commit/2eb3a0e4e9724297f362f2bb7b76155a10ab7444

or: https://github.com/SeleniumHQ/selenium/commit/baedf6b16b6a0a0b410a7056c853a5fa1fbe006c

@pujagani @diemol