3

I have a selenium grid that uses the following config:

{
  "port": 4444,
  "newSessionWaitTimeout": 2000
}

and 2 nodes that use this config:

{
  "capabilities": [{
    "browserName": "chrome",
    "platform": "LINUX",
    "maxInstances": 8
  }],
  "configuration": {
    "nodeTimeout": 120,
    "port": 5555,
    "hubPort": 4444,
    "hubHost": "hubhost",
    "nodePolling": 2000,
    "registerCycle": 10000,
    "register": true,
    "cleanUpCycle": 2000,
    "timeout": -1,
    "browserTimeout": -1,
    "maxSession": 8
  }
}

I wrote a piece of Java-Code that opens a connection via the RemoteWebDriver-Class. The code does several calls on the driver and afterward suspends for unknown time (30s - 1h). I don't want to close the session, because on wake, the process needs to react really fast.

With the timeout set to -1 everything works. The process will stay connected to the session (and the browser) for unlimited time. Unfortunately, the process is killed at random, when an automatic service decides to. The node recognizes that the client shuts down:

selenium deleted due to client timeout

But the sessions aren't cleaned up! The unlimited timeout keeps them alive and the grid won't free them for further use.

How can I solve this problem with the selenium config?

Building a process-shutdown-hook that calls "driver.quit()" to free the session, is not an option.

Thanks for any help!

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
Chris
  • 53
  • 1
  • 5

1 Answers1

0

Did you notice the "cleanUpCycle": 2000 setting in the config ? It means that the Hub will cleanup itself in 2000 milliseconds !

Linus
  • 880
  • 13
  • 25