docker-selenium icon indicating copy to clipboard operation
docker-selenium copied to clipboard

[🐛 Bug]: SE_NODE_SESSION_TIMEOUT ignored; session stays active > configured timeout

Open Nagam-Naidu opened this issue 3 months ago • 3 comments

What happened?

Even though I’ve set SE_NODE_SESSION_TIMEOUT=1200 (20 minutes) and SE_OPTS=--session-timeout 1200 --log-level SEVERE in the Node container, browser sessions continue to show durations > 1 hour in the Selenium Grid UI and do not automatically terminate after idle timeout.

To Reproduce Steps to reproduce the behavior:

Start Selenium Hub + Node (e.g. Docker, Kubernetes) with the following environment settings:

`- name: SE_NODE_SESSION_TIMEOUT value: "1200"

  • name: SE_OPTS value: "--session-timeout 1200 --log-level SEVERE"
  • name: SE_SESSION_REQUEST_TIMEOUT value: "600" ` Run a WebDriver test that purposely hangs (e.g. driver.get("https://slowpage.example.com") that doesn’t complete).

Watch the Grid UI (Sessions table) — note that even after 20 minutes of inactivity, the “Duration” for the session continues increasing (e.g. 1.3h).

Image

Expected behavior: After ~20 minutes of inactivity (no WebDriver commands), the session should be terminated and removed from grid — i.e., “Duration” should stop / disappear.

Actual behavior: Sessions persist indefinitely (or until manual kill via API), showing durations much longer than configured idle timeout.

Environment:

Docker-Selenium version / tag (e.g. selenium/node-chrome:4.23.0-20241008)

kubernetes yaml for chrome node: apiVersion: apps/v1 kind: Deployment metadata: name: {{ .Release.Name }} labels: app: {{ .Release.Name }} spec: replicas: 40 selector: matchLabels: app: {{ .Release.Name }} template: metadata: labels: app: {{ .Release.Name }} spec: volumes: - name: dshm emptyDir: medium: Memory sizeLimit: 2Gi containers: - name: {{ .Release.Name }} image: selenium/node-chrome:4.21.0-20240521 ports: - containerPort: 5555 - containerPort: 5900 #vnc port env: - name: SELENIUM_LOG_LEVEL value: "ERROR" - name: SE_EVENT_BUS_HOST value: "selenium-hub-c-test" - name: SE_EVENT_BUS_SUBSCRIBE_PORT value: "4443" - name: SE_EVENT_BUS_PUBLISH_PORT value: "4442" - name: SE_NODE_SESSION_TIMEOUT value: "1200" - name: SE_SESSION_REQUEST_TIMEOUT value: "600" - name: JAVA_OPTS value: "-Dwebdriver.chrome.whitelistedIps=" - name: HUB_PORT_4444_TCP_ADDR value: "selenium-hub-c-test" - name: HUB_PORT_4444_TCP_PORT value: "4444" - name: SE_NODE_GRID_URL value: https://selenium-dc-c.deepintent.com/wd/hub - name: SE_NODE_PORT value: "5555" - name: SE_START_VNC value: "False" - name: SE_START_XVFB value: "False" - name: SE_DRAIN_AFTER_SESSION_COUNT value: "5" - name: NODE_MAX_SESSION value: "1" # - name: SE_NODE_HOST # value: "0.0.0.0" - name: SCREEN_WIDTH value: "1920" - name: SCREEN_HEIGHT value: "1024" - name: SE_VNC_NO_PASSWORD value: "1" - name: SE_SESSION_RETRY_INTERVAL value: "2" - name: JAVA_OPTS value: "-Djdk.httpclient.websocket.intermediateBufferSize=3000000 -Dwebdriver.chrome.whitelistedIps=" - name: SELENIUM_LOG_LEVEL value: "ERROR" - name: CHROME_OPTS value: "--no-sandbox --headless" - name: SE_SESSION_TIMEOUT value: "1200" - name: SE_OPTS value: "--log-level SEVERE" volumeMounts: - mountPath: /dev/shm name: dshm resources: limits: memory: "3000Mi" cpu: "500m"

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

kubectl -n platform-sre rollout restart deployment/selenium-chrome-node-c-test
kubectl -n platform-sre rollout status deployment/selenium-chrome-node-c-test

Relevant log output

selenium-chrome-node-c-test-6d686c67df-svfmj selenium-chrome-node-c-test 05:52:56.754 INFO [ProxyNodeWebsockets.createWsEndPoint] - Establishing connection to ws://localhost:43797/devtools/browser/ac8483eb-fa03-4784-8926-6a9a26980658
selenium-chrome-node-c-test-6d686c67df-svsks selenium-chrome-node-c-test 05:16:37.394 INFO [LocalNode.newSession] - Session created by the Node. Id: 35dfba80429ae1e5bf829fad07b484dc, Caps: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 125.0.6422.76, chrome: {chromedriverVersion: 125.0.6422.76 (67dcf7562b8f..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:37699}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: wss://selenium-dc-c.deepint..., se:cdpVersion: 125.0.6422.76, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
selenium-chrome-node-c-test-6d686c67

Operating System

kubernetes

Docker Selenium version (image tag)

4.23.0-20241008

Selenium Grid chart version (chart version)

No response

Nagam-Naidu avatar Oct 10 '25 11:10 Nagam-Naidu

@Nagam-Naidu, 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!

github-actions[bot] avatar Oct 10 '25 11:10 github-actions[bot]

Between 4.23.0 and latest 4.36.0, there were several updates to improve timeout in Node. If you are pinning a browser version, we also deliver images with the latest Grid vs different backward browser versions https://github.com/SeleniumHQ/docker-selenium/tree/trunk/CHANGELOG Can you upgrade and confirm it is able to solve your problem with stale sessions?

VietND96 avatar Oct 11 '25 11:10 VietND96

sure will check and update

Nagam-Naidu avatar Oct 17 '25 07:10 Nagam-Naidu