Skip to content

Docker: Add Node env var SE_NODE_CONNECTION_LIMIT_PER_SESSION and README #2855

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

Merged
merged 1 commit into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ENV_VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,6 @@
| SE_NODE_REGISTER_SHUTDOWN_ON_FAILURE | true | If this flag is enabled, the Node will shut down after the register period is completed. This is useful for container environments to restart and register again. If restarted multiple times, the Node container status will be CrashLoopBackOff | --register-shutdown-on-failure |
| SE_NODE_RELAY_BROWSER_VERSION | | | |
| SE_NODE_RELAY_ONLY | true | | |
| SE_EXTRA_LIBS | | Extra jars to add to the classpath | --ext |
| SE_EXTRA_LIBS | | Extra jars to add to the classpath in server component bootstrap | --ext |
| SE_NODE_CONNECTION_LIMIT_PER_SESSION | 10 | | |
| SE_SUPERVISORD_UNIX_SERVER_PASSWORD | secret | | |
1 change: 1 addition & 0 deletions NodeBase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ENV LANG_WHICH=${LANG_WHICH} \
SE_NODE_REGISTER_PERIOD="120" \
SE_NODE_REGISTER_CYCLE="10" \
SE_NODE_REGISTER_SHUTDOWN_ON_FAILURE="true" \
SE_NODE_CONNECTION_LIMIT_PER_SESSION="10" \
SE_OTEL_SERVICE_NAME="selenium-node" \
SE_NODE_RELAY_ONLY="true" \
# Setting Selenium Manager to work offline
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1901,5 +1901,14 @@ mkdir /tmp/videos
chown 1200:1201 /tmp/videos
```

### Websocket connections per session get exhausted

> org.openqa.selenium.remote.http.ConnectionFailedException: JdkWebSocket initial request execution error`

This was reported in [#2850](https://github.com/SeleniumHQ/docker-selenium/issues/2850).
Actually, from Grid version v4.26.0+, in Node CLI option `--connection-limit-per-session` (`SE_NODE_CONNECTION_LIMIT_PER_SESSION` environment variable) is set to `10` by default. Let X be the maximum number of websocket connections per session.This will ensure one session is not able to exhaust the connection limit of the host. Websocket connection might come from enable CDP, BiDi.

Your test scenario or test framework implementation might be creating more than `X` connections per session, which will lead to the error above. You can optimize your implementation to use less connections per session, or you can increase the limit by setting the environment variable `SE_NODE_CONNECTION_LIMIT_PER_SESSION` to a value higher than `10` to allow more connections per session.

## Stargazers over time
[![Stargazers over time](https://starchart.cc/SeleniumHQ/docker-selenium.svg?variant=adaptive)](https://starchart.cc/SeleniumHQ/docker-selenium)
9 changes: 9 additions & 0 deletions scripts/generate_list_env_vars/description.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,12 @@
- name: SE_NODE_RELAY_ONLY
description: ''
cli: ''
- name: SE_EXTRA_LIBS
description: Extra jars to add to the classpath in server component bootstrap
cli: --ext
- name: SE_NODE_CONNECTION_LIMIT_PER_SESSION
description: ''
cli: ''
- name: SE_SUPERVISORD_UNIX_SERVER_PASSWORD
description: ''
cli: ''
6 changes: 6 additions & 0 deletions scripts/generate_list_env_vars/value.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
default: '4443'
- name: SE_EXTERNAL_URL
default: ''
- name: SE_EXTRA_LIBS
default: ''
- name: SE_FRAME_RATE
default: '15'
- name: SE_GRID_URL
Expand Down Expand Up @@ -78,6 +80,8 @@
default: ''
- name: SE_NODE_BROWSER_VERSION
default: stable
- name: SE_NODE_CONNECTION_LIMIT_PER_SESSION
default: '200'
- name: SE_NODE_CONTAINER_NAME
default: ''
- name: SE_NODE_DOCKER_CONFIG_FILENAME
Expand Down Expand Up @@ -240,6 +244,8 @@
default: /tmp/supervisord.pid
- name: SE_SUPERVISORD_START_RETRIES
default: '5'
- name: SE_SUPERVISORD_UNIX_SERVER_PASSWORD
default: secret
- name: SE_UPLOAD_COMMAND
default: ''
- name: SE_UPLOAD_DESTINATION_PREFIX
Expand Down
Loading