question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: Informed driver port not being used - The port minus one is the port being used. Why?

See original GitHub issue

What happened?

The selected port for the ChromeDriver doesn’t look right.

Why the port selected by the ChromeDriver receives a - 1 ?

def socket_lock
   @socket_lock ||= SocketLock.new(@port - 1, SOCKET_LOCK_TIMEOUT)
end

I took a look at the documentation, but I couldn’t find a reason.

See https://github.com/SeleniumHQ/selenium/blob/e3e492af0c9d9c99ce31b9dc036dbf75327e6f30/rb/lib/selenium/webdriver/common/service_manager.rb

How can we reproduce the issue?

Start a ChromeDriver by choosing a busy port.

Example

For this example, we’re choosing port 9999.

First, let’s make the port 9998 busy (port 9999 - 1)

python -m SimpleHTTPServer 9998

Second, let’s try to instantiate the ChromeDriver in the port 9999

 driver = Selenium::WebDriver.for(:chrome,  service: 
 Selenium::WebDriver::Chrome::Service.chrome(port: 9999))

Relevant log output

image

Operating System

Ubuntu 18.04

Selenium version

4.0.3

What are the browser(s) and version(s) where you see this issue?

N/A

What are the browser driver(s) and version(s) where you see this issue?

N/A

Are you using Selenium Grid?

No

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
titusfortnercommented, Dec 24, 2021

Yeah, what we’re doing is locking the port - 1 with SocketLock#lock and then using PortProber#above to find the next available port to start the driver. This typically works fine because the port below the default ports is usually available.

I’m not sure why we do it this way, though. @twalpole or @p0deje do you have insight on this?

Bottom line is that Selenium will use the provided port, but you need to have the port below it available as well.

0reactions
github-actions[bot]commented, Feb 5, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

COM ports Windows 10: fix any COM port issues in 2 easy ways
We are going to show you two different methods you can use to add COM ports to Windows 10. One is a procedure...
Read more >
516 Port refresh not working on USB-serial port - YAT
Auto-refresh should work on USB driver based COM ports. ... without closing the port may result in the port no longer being usable....
Read more >
Troubleshooting Port Problems - InformIT
Troubleshooting Port Problems. Failures of the serial, parallel, and game ports tend to end with poor or no operation of the peripheral.
Read more >
TCP and UDP port usage
How to enforce? - Recall every packet in TCP flow except first has ACK. - Block incoming TCP packets w. SYN flag but...
Read more >
Initializing the Driver - PostgreSQL JDBC Driver
Defaults to the PostgreSQL® standard port number (5432). database = The database name ... This property is no longer used by the driver...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found