Skip to content

[🐛 Bug]: ConnectionFailedException: JdkWebSocket initial request execution error #2850

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

Open
IlyaUk opened this issue May 30, 2025 · 4 comments

Comments

@IlyaUk
Copy link

IlyaUk commented May 30, 2025

What happened?

An attempt to upgrade Selenium hub and Chrome nodes from version 4.25.0-20240922 to the latest ones shows that there is an error related to CDP - ConnectionFailedException: JdkWebSocket initial request execution error.
The issue is reproducible starting from 4.26.0-20241101 till the latest versions: 4.33.0-20250525.
The only one workaround to avoid the issue - set Selenium flag --enable-cdp false for Chrome nodes and disable all tests that use CDP features.

Command used to start Selenium Grid with Docker (or Kubernetes)

version: "3"
services:
  selenium-hub:
    image: selenium/hub:4.32.0-20250505
    container_name: selenium-hub
    ports:
      - "4444:4444"
      - "4443:4443"
      - "4442:4442"
    environment:
      - SE_ENABLE_TRACING=false
    healthcheck:
      test: "/opt/bin/check-grid.sh --host 0.0.0.0 --port 4444"
      interval: "15s"
      timeout: "30s"
      retries: 5
    restart: always

  chrome:
    image: selenium/node-chrome:4.32.0-20250505
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_VNC_NO_PASSWORD=1
      - SE_SCREEN_WIDTH=1600
      - SE_SCREEN_HEIGHT=900
      - SE_NODE_MAX_SESSIONS=1
      - SE_NODE_MAX_INSTANCES=1
      - SE_NODE_GRID_URL=http://${host}:4444
      - SE_OPTS=--enable-managed-downloads true --enable-cdp true
      - SE_ENABLE_TRACING=false
      - JAVA_OPTS=-Djava.net.preferIPv4Stack=true
    restart: always
    deploy:
      mode: replicated
      replicas: 8

Relevant log output

Caused by: org.openqa.selenium.remote.http.ConnectionFailedException: JdkWebSocket initial request execution error
Build info: version: '4.32.0', revision: 'd17c8aa950'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.8.0-1024-aws', java.version: '17.0.5'
Driver info: driver.version: unknown
	at org.openqa.selenium.remote.http.jdk.JdkHttpClient.openSocket(JdkHttpClient.java:253)
	at org.openqa.selenium.devtools.Connection.<init>(Connection.java:89)
	at org.openqa.selenium.devtools.SeleniumCdpConnection.<init>(SeleniumCdpConnection.java:36)
	at org.openqa.selenium.devtools.SeleniumCdpConnection.lambda$create$2(SeleniumCdpConnection.java:103)
	at java.base/java.util.Optional.map(Optional.java:260)
	at org.openqa.selenium.devtools.SeleniumCdpConnection.create(SeleniumCdpConnection.java:103)
	at org.openqa.selenium.devtools.SeleniumCdpConnection.create(SeleniumCdpConnection.java:49)
	at org.openqa.selenium.devtools.DevToolsProvider.getImplementation(DevToolsProvider.java:50)
	at org.openqa.selenium.devtools.DevToolsProvider.getImplementation(DevToolsProvider.java:29)
	at org.openqa.selenium.remote.Augmenter.augment(Augmenter.java:207)
	at org.openqa.selenium.remote.Augmenter.augment(Augmenter.java:178)
... 13 more
Caused by: java.net.http.WebSocketHandshakeException
	at java.net.http/jdk.internal.net.http.websocket.OpeningHandshake.resultFrom(OpeningHandshake.java:226)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:844)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: jdk.internal.net.http.websocket.CheckFailedException: Unexpected HTTP response status code 400
	at java.net.http/jdk.internal.net.http.websocket.OpeningHandshake.checkFailed(OpeningHandshake.java:343)
	at java.net.http/jdk.internal.net.http.websocket.OpeningHandshake.handleResponse(OpeningHandshake.java:252)
	at java.net.http/jdk.internal.net.http.websocket.OpeningHandshake.resultFrom(OpeningHandshake.java:222)
	... 10 more

Operating System

Windows 11, Ubuntu 22.04.5 LTS, MacOS 15.5

Docker Selenium version (image tag)

4.32.0-20250505

Selenium Grid chart version (chart version)

Copy link

@IlyaUk, 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, MSEdgeDriver, 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!

@VietND96
Copy link
Member

Can you also share a client script to reproduce?

@IlyaUk
Copy link
Author

IlyaUk commented Jun 2, 2025

Hi @VietND96
It seems like I need a little bit more time for testing the issue by myself. When I started to prepare a script to reproduce the problem in a new project with Selenium dependency only the problem has gone. So it seems like the issue might be connected with some other dependency I'm using in my project.

@amardeep2006
Copy link
Contributor

I will also suggest you to upgrade your test framework as well. It's a good practice to keep test framework updated to avoid any CDP compatibility issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants