SeleniumHQ / SeleniumHQ/docker-selenium
[🐛 Bug]: SE_NODE_SESSION_TIMEOUT ignored; session stays active > configured timeout
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.7k
- Forks
- 2.5k
- Avg merge
- 10h 16m
- Merged PRs (30d)
- 20
Description
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).
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported behavior with the Kubernetes node configuration and the SE_NODE_SESSION_TIMEOUT=1200 setting, then inspect the session shown in the Grid UI. Confirm whether a hanging WebDriver command is treated differently from an idle session, and consider the issue done when the configured timeout reliably terminates the session or the expected limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, kubernetes
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100