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
"Exception: Unable to find a free port" - SeGrid/Python/Chromedriver/Ubuntu+OSX #1630
Comments
Did some further digging and found a post that suggested amending the ip_local_port_range to not include the '1024' value included in the ProbeProperties.java file worked around the issue. I made the change and was just able to run two tests in parallel. Again, i don't know enough of the java code to see why that made a difference, but there seems to be some needed adjustment to the logic of the free port check. |
I had exactly the same exception in the selenium-standalone-server error output. It turned out that I had statements in my /etc/hosts file that I had to remove (or comment out), e.g.
|
I confirm that the problem is solved by removing all of the localhost specific rules from |
If you still want to be access a server that was defined in your localhost, you can do what is described here: Run this on Windows, example:
|
I have the same problem running on Linux. So after reading the responses and a week thinking that the problem was in my localhost definition or webdriver/driver/selenium versions, i've read the When you have defined in the "/proc/sys/net/ipv4/ip_local_port_range" the port range 1024-65535, the method returns always 1024. So if you change your range defined in the file to 1025-65535 (or whatever) it will work returning random ports. |
Thank you @DavidGDD |
Is this still an issue? |
@p0deje No. This is just a config change for Ubuntu. This ticket could be closed now. Thanks. |
It can be solved by host configuration, but i think |
I can't confirm that it solves the issue. We have xvfb and selenium running on a linux server using supervisor and we get this message at least twice a day with only two developers working on projects using this ci server. In
Anyway it's somehow annoying that we can not define the port somewhere and such a simple task as "find an unused port" fails because the java sources have a bug. Would a pull request be accepted? |
I guess the problem is here: The problem is that the file has more than one space between the two ports. So the result will be There we have the next problem: First we get the highest and lowest ports from the platform and then we overwrite one or the other 1024 or 65535 (not even the constants defined before). I don't get the benefit from this if-else-statement. |
perhaps if it includes an explanation that is more coherent than your comment, which is nearly impossible to understand. |
@tflori if there is an issue that you have fixed, go ahead and submit a PR... commenting on the fixes in a closed issue isn't helpful. |
Short Description:
on attempting to execute parallel tests on a host using selenium grid, the server-standalone hub accepts the first session and rejects all subsequent requests to create a session until the first terminates.
Longer Description:
I am not a java developer, so I can only dig so deeply, but it does look like something is not being correctly executed in the PortProber.java class. However, it may be something to do with the python requests to create a new session. I spent some time digging into the python code and wasn't able to find a way to force a particular port be requested for the new session.
We're trying to run multiple scripts on a headless virtual. This pattern has worked previously, but we needed to make updates to our chrome version, so we went ahead and updated the selenium-standalone version (I've tried 2.49-2.52), chromedriver (2.20-2.21), and Chrome (48.0.2564.82). In fact, in developing the python test script, I was able to run 4 sessions simultaneously on my OSX laptop. That is no longer the case (server standalone 2.50/2.52 tried - 2.50 previously worked)
I did try the selenium-server-standalone + a quick webdriver.io (nodeJS) script and it appears to work on my laptop.
Script to recreate:
(start one instance, then start another on the same system)
Python Script Error:
selenium-standalone-server error output:
The text was updated successfully, but these errors were encountered: