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]: chromedriver service is not killed

See original GitHub issue

What happened?

Even after calling driver.quit. Not able to start chrome driver on the same port. Server is not getting killed and the port is not released.

How can we reproduce the issue?

const webdriver = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const BROWSER_NAME = webdriver.Browser.CHROME;

async function getDriver() {
  let service = new chrome.ServiceBuilder(require('chromedriver').path).setPort(9515);

  service.setStdio(['pipe', process.stdout, process.stderr]);

  return new webdriver.Builder()
    .setChromeService(service)
    .forBrowser(BROWSER_NAME)
    .build();
}

async function runTestWithCaps() {
  for (i = 0; i <= 5; i++) {
    try {
      driver = await getDriver();
      await driver.get("http://www.google.com");
      await driver.quit();
    } catch(err) {
      console.log(err);
    }
  }
}

runTestWithCaps();

Relevant log output

tarting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.


Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1655906636.622][SEVERE]: bind() failed: Address already in use (48)
IPv4 port not available. Exiting...


Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1655906639.852][SEVERE]: bind() failed: Address already in use (48)
IPv4 port not available. Exiting...


Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1655906642.727][SEVERE]: bind() failed: Address already in use (48)
IPv4 port not available. Exiting...

Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1655906647.038][SEVERE]: bind() failed: Address already in use (48)
IPv4 port not available. Exiting...

Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1655906651.742][SEVERE]: bind() failed: Address already in use (48)

Operating System

macOS Monterey

Selenium version

4.2.2

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

chrome 102

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

chromedriver 102

Are you using Selenium Grid?

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
gravityvicommented, Jun 29, 2022

@praveendvd yes will do that

1reaction
gravityvicommented, Jun 29, 2022

@praveendvd the issue is only happening with chrome service and I think it’s due to this line: https://github.com/SeleniumHQ/selenium/blob/4ad053312fdcc63fd0052a1a9611e999fa4e60c7/javascript/node/selenium-webdriver/chrome.js#L276-L281 It returns defaultService if it has been already created once.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Selenium: WebDriverException:Chrome failed to start ...
Your main issue is the Chrome browser is not installed at the default location within your system. The server i.e. ChromeDriver expects you...
Read more >
Resolving failed to create ChromeDriver error - Provar
Note: Ensure that there are no ChromeDriver processes running. Kill the processes if there are any. Step 3: Execute the test case to...
Read more >
Downloads - ChromeDriver - WebDriver for Chrome
Resolved issue 3641: Page not getting loaded/rendered when browser window is not in focus with Chrome Beta v87 and chromedriver v(87/86).
Read more >
Download the right ChromeDriver version & keep it up to date ...
When the ChromeDriver is incompatible with the installed version of Google Chrome, you will run into the error above. The fix is pretty...
Read more >
ServiceWorker is shut down every 5 minutes for manifest V3 ...
In MV3 the service worker is being killed after 5 minutes even though we have open ... V2 no longer accepts Chrome Store...
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