From f217350251dbf05453eeeb8b6e874276eab0f866 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Sat, 7 Jun 2025 00:51:59 +0700 Subject: [PATCH] Docker: Add Node env var `SE_NODE_CONNECTION_LIMIT_PER_SESSION` and README Signed-off-by: Viet Nguyen Duc --- ENV_VARIABLES.md | 4 +++- NodeBase/Dockerfile | 1 + README.md | 9 +++++++++ scripts/generate_list_env_vars/description.yaml | 9 +++++++++ scripts/generate_list_env_vars/value.yaml | 6 ++++++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ENV_VARIABLES.md b/ENV_VARIABLES.md index 3db4f7f05c..558267fd48 100644 --- a/ENV_VARIABLES.md +++ b/ENV_VARIABLES.md @@ -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 | | | diff --git a/NodeBase/Dockerfile b/NodeBase/Dockerfile index 7994c21f43..c83e27f126 100644 --- a/NodeBase/Dockerfile +++ b/NodeBase/Dockerfile @@ -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 diff --git a/README.md b/README.md index 9c37afba8f..d97a3cf08e 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/scripts/generate_list_env_vars/description.yaml b/scripts/generate_list_env_vars/description.yaml index 82489e3173..327659c2dd 100644 --- a/scripts/generate_list_env_vars/description.yaml +++ b/scripts/generate_list_env_vars/description.yaml @@ -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: '' diff --git a/scripts/generate_list_env_vars/value.yaml b/scripts/generate_list_env_vars/value.yaml index 1942019c86..620fe310b4 100644 --- a/scripts/generate_list_env_vars/value.yaml +++ b/scripts/generate_list_env_vars/value.yaml @@ -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 @@ -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 @@ -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