selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🐛 Bug]: Slow session creation with Selenium 4

Open cyberflohr opened this issue 4 years ago • 3 comments

What happened?

Creating a new selenium session (e.g. chrome, firefox) is 3 times slower (5-7 seconds) with Selenium 4 compared to Selenium 3 (1-2 seconds).

The log output shows a big delay (up to 5 secs) between the creation of the RemoteWebDriver instance on the client-side and the log output of the hub "Session request received by the distributor".

Client: 16:46:17.005 [main] INFO NodeSelectTest - Creating remote driver Hub: 16:46:21.759 INFO [LocalDistributor.newSession] - Session request received by the distributor

How can we reproduce the issue?

I've created a simple test case to show the behavior. See README.md for instructions.

https://github.com/cyberflohr/selenium-node-test

PS: Trying to create a Firefox session, which obviously will not work because the set-up only contains Chrome nodes, will also show this 5-second delay until the server responds with an error message.

Relevant log output

Docker container logs

hub_1     | 16:46:21.759 INFO [LocalDistributor.newSession] - Session request received by the distributor:
hub_1     |  [Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}]
chrome_1  | Starting ChromeDriver 94.0.4606.61 (418b78f5838ed0b1c69bb4e51ea0252171854915-refs/branch-heads/4606@{#1204}) on port 45659
chrome_1  | Only local connections are allowed.
chrome_1  | Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
chrome_1  | ChromeDriver was started successfully.
chrome_1  | [1640709981.951][SEVERE]: bind() failed: Cannot assign requested address (99)
chrome_1  | 16:46:23.426 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
hub_1     | 16:46:23.492 INFO [LocalDistributor.newSession] - Session created by the distributor. Id: c6d12c99edc2731d63a73e077491d728, Caps: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 94.0.4606.81, chrome: {chromedriverVersion: 94.0.4606.61 (418b78f5838ed..., userDataDir: /tmp/.com.google.Chrome.uedrAE}, goog:chromeOptions: {debuggerAddress: localhost:39151}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: {}, se:cdp: ws://0.0.0.0:4444/session/c..., se:cdpVersion: 94.0.4606.81, se:vnc: ws://0.0.0.0:4444/session/c..., se:vncEnabled: true, se:vncLocalAddress: ws://172.24.0.3:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
hub_1     | 16:46:23.735 INFO [LocalSessionMap.lambda$new$0] - Deleted session from local session map, Id: c6d12c99edc2731d63a73e077491d728


Test output:

16:46:17.005 [main] INFO NodeSelectTest - Creating remote driver
16:46:23.580 [main] INFO NodeSelectTest - Chrome remote created
16:46:23.580 [main] INFO NodeSelectTest - Destroying driver
16:46:23.778 [main] INFO NodeSelectTest - Driver destroyed

Operating System

macOS - Docker Desktop 4.3

Selenium version

Java 4.0.0

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

Chrome 94

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

Chrome 94

Are you using Selenium Grid?

4.1.1

cyberflohr avatar Dec 28 '21 17:12 cyberflohr

@cyberflohr, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] avatar Dec 28 '21 17:12 github-actions[bot]

Thank you for providing the details. This seems to be a duplicate of https://github.com/SeleniumHQ/selenium/issues/10242. Please follow #10242 for updates.

pujagani avatar Jan 12 '22 14:01 pujagani

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.

github-actions[bot] avatar Feb 12 '22 00:02 github-actions[bot]