[🐛 Bug]: Selenium grid 4.49.0 - idle sessions are not remove after session timeout and unable to delete sessions

Open
#18,062 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java, linux

Research direction

Reproduce the session-timeout and DELETE behavior using Selenium Grid 4.49.0, then compare it with the last known working 4.44.0. Start with LocalNode.java and StopNodeSession.java, which appear in the reported stack trace; done means idle sessions are removed after the configured timeout and the node DELETE endpoint can remove an existing session.

Written by the indexing model from the issue text.

Description

A-needs-triaging B-grid C-java D-chrome I-defect I-regression OS-linux
Description

I start the selenium grid on a linux server using below commands:

nohup java -Dwebdriver.http.factory=jdk-http-client -jar selenium-server-4.49.0.jar hub &

nohup java -Dwebdriver.http.factory=jdk-http-client -Dwebdriver.chrome.driver=./chromedriver -Dwebdriver.chrome.whitelistedIps= -jar selenium-server-4.49.0.jar node --selenium-manager true --override-max-sessions true --max-sessions 20 --session-timeout 72000 --delete-session-on-ui true &

If a session is still active after 20 hours, it used to be automatically removed as per the configuration above.
In Selenium Grid 4.48.0 and 4.49.0, this functionality is broken.
Sessions remain active indefinitely.

I have tried deleting the sessions with:
curl --request DELETE "http://localhost:5555/se/grid/node/session/" --header "X-REGISTRATION-SECRET;"

but still not able to do so and I get the error
{
"value": {
"error": "invalid session id",
"stacktrace": "org.openqa.selenium.NoSuchSessionException: Cannot find session with id: 721500a671676dcf1e489c30f24eeb63\nBuild info: version: '4.49.0', revision: 'bedb24f bedb24f6f703876e7e4c5d506f0d697eb358c720'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-553.84.1.el8_10.x86_64', java.version: '17.0.17'\nDriver info: driver.version: unknown\n\tat org.openqa.selenium.grid.node.local.LocalNode.stop(LocalNode.java:1178)\n\tat org.openqa.selenium.grid.node.StopNodeSession.execute(StopNodeSession.java:38)\n\tat org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\n\tat org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:61)\n\tat org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:87)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:358)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\n\tat org.openqa.selenium.grid.node.Node.execute(Node.java:316)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:358)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\n\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\n\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:49)\n\tat java.base\u002fjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)\n\tat java.base\u002fjava.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:840)\n",
"message": "Cannot find session with id: 721500a671676dcf1e489c30f24eeb63\nBuild info: version: '4.49.0', revision: 'bedb24f bedb24f6f703876e7e4c5d506f0d697eb358c720'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-553.84.1.el8_10.x86_64', java.version: '17.0.17'\nDriver info: driver.version: unknown"

Reproducible Code
--session-timeout config in CLI does not work

and

curl --request DELETE "http://localhost:5555/se/grid/node/session/<session-id>" --header "X-REGISTRATION-SECRET;"

results in below error:

{
  "value": {
    "error": "invalid session id",
    "stacktrace": "org.openqa.selenium.NoSuchSessionException: Cannot find session with id: 721500a671676dcf1e489c30f24eeb63\nBuild info: version: '4.49.0', revision: 'bedb24f bedb24f6f703876e7e4c5d506f0d697eb358c720'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-553.84.1.el8_10.x86_64', java.version: '17.0.17'\nDriver info: driver.version: unknown\n\tat org.openqa.selenium.grid.node.local.LocalNode.stop(LocalNode.java:1178)\n\tat org.openqa.selenium.grid.node.StopNodeSession.execute(StopNodeSession.java:38)\n\tat org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle(Route.java:192)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\n\tat org.openqa.selenium.grid.security.RequiresSecretFilter.lambda$apply$0(RequiresSecretFilter.java:61)\n\tat org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:87)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:358)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\n\tat org.openqa.selenium.grid.node.Node.execute(Node.java:316)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:358)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:69)\n\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)\n\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:49)\n\tat java.base\u002fjava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)\n\tat java.base\u002fjava.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:840)\n",
    "message": "Cannot find session with id: 721500a671676dcf1e489c30f24eeb63\nBuild info: version: '4.49.0', revision: 'bedb24f bedb24f6f703876e7e4c5d506f0d697eb358c720'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-553.84.1.el8_10.x86_64', java.version: '17.0.17'\nDriver info: driver.version: unknown"

ℹ️ Last known working version: 4.44.0

Dominant language
Java
Stars
34.5k
Forks
8.7k
Avg merge
1d 12h
Merged PRs (30d)
91

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SeleniumHQ/selenium

All issues in SeleniumHQ/selenium

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.