Selenium Hub + Node: Cleaning up stale test sessions on the unregistered node

2.5k views Asked by At

I have two machines:
1. Linux Centos 6.4
2. Mac OS X 10.8

Linux starts the hub:

[root@jenkins tools]# java -jar selenium-server-standalone-2.46.0.jar -role hub -port 4444

11:35:00.898 INFO - Launching Selenium Grid hub
2015-06-15 11:35:01.744:INFO:osjs.Server:jetty-7.x.y-SNAPSHOT
2015-06-15 11:35:01.969:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContextHandler{/,null}
2015-06-15 11:35:02.028:INFO:osjs.AbstractConnector:Started [email protected]:4444
11:35:02.029 INFO - Nodes should register to http://192.168.1.110:4444/grid/register/
11:35:02.031 INFO - Selenium Grid hub is up and running

Then I start the node (Mac):

tomas@tororrosso ~/Q/A/tools> java -jar selenium-server-standalone-2.46.0.jar -role node  -hub http://192.168.1.110:4444/grid/register/ -host "http://192.168.1.254" -port 4445 --debug

11:36:00.190 INFO - Launching a Selenium Grid node
11:36:00.635 INFO - Java: Apple Inc. 20.51-b01-457
11:36:00.635 INFO - OS: Mac OS X 10.8.5 x86_64
11:36:00.639 INFO - v2.46.0, with Core v2.46.0. Built from revision 87c69e2
11:36:00.675 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match the current platform MAC
11:36:00.676 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:36:00.676 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
11:36:00.678 INFO - Driver class is built for higher Java version: org.openqa.selenium.htmlunit.HtmlUnitDriver
11:36:00.678 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
11:36:00.693 INFO - Version Jetty/5.1.x
11:36:00.694 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:36:00.694 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:36:00.694 INFO - Started HttpContext[/,/]
11:36:00.700 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@65493102
11:36:00.700 INFO - Started HttpContext[/wd,/wd]
11:36:00.702 INFO - Started SocketListener on 0.0.0.0:4445
11:36:00.702 INFO - Started org.openqa.jetty.jetty.Server@2092dcdb
11:36:00.703 INFO - Selenium Grid node is up and ready to register to the hub
11:36:00.726 INFO - Starting auto registration thread. Will try to register every 5000 ms.
11:36:00.727 INFO - Registering the node to the hub: http://192.168.1.110:4444/grid/register
11:36:00.735 INFO - The node is registered to the hub and ready to use

Everything seems so perfect and wonderful until....

In the hub:

11:36:50.904 WARN - Cleaning up stale test sessions on the unregistered node http://http://192.168.1.254:4445

And the node:

11:36:05.774 INFO - Registering the node to the hub: http://192.168.1.110:4444/grid/register
11:36:05.785 INFO - The node is registered to the hub and ready to use

And they are like this to the infinity and beyond.

More Information

Both machines can see each other:

tomas@tororrosso ~> ping 192.168.1.110
PING 192.168.1.110 (192.168.1.110): 56 data bytes
64 bytes from 192.168.1.110: icmp_seq=0 ttl=64 time=0.585 ms
64 bytes from 192.168.1.110: icmp_seq=1 ttl=64 time=0.586 ms
64 bytes from 192.168.1.110: icmp_seq=2 ttl=64 time=0.606 ms
^C
--- 192.168.1.110 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.585/0.592/0.606/0.010 ms


[root@jenkins ]# ping 192.168.1.254
PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
64 bytes from 192.168.1.254: icmp_seq=1 ttl=64 time=0.521 ms
64 bytes from 192.168.1.254: icmp_seq=2 ttl=64 time=0.541 ms
^C
--- 192.168.1.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1933ms
rtt min/avg/max/mdev = 0.521/0.531/0.541/0.010 ms

I tried this too:

java -jar selenium-server-standalone-2.46.0.jar -role node  -hubHost 192.168.1.110 -hubPort 4444  -host "http://192.168.1.254" -port 4446 --debug

But every 5 seconds it keeps re-registering.

1

There are 1 answers

0
Tomás On BEST ANSWER

I just executed the node with this config and it worked:

{
  "capabilities":
  [
    {
      "browserName": "firefox",
      "version": "38.0.5",
      "platform": "MAC",
      "maxInstances": 1
    },
    {
      "browserName": "chrome",
      "version": "43",
      "platform": "MAC",
      "maxInstances": 1
    }
  ],
  "configuration":
  {
    "nodeTimeout":120,
    "host":"192.168.1.254",
    "port":4446,

    "hubPort":4444,
    "hubHost":"192.168.1.110",

    "nodePolling":2000,

    "registerCycle":10000,
    "register":true,
    "cleanUpCycle":2000,
    "timeout":30000,
    "maxSession":1
  }
}

Saved it as mac.json

Then executed the node as:

tomas@tororrosso ~> java -jar selenium-server-standalone-2.46.0.jar -role node  -nodeConfig mac.json 

And everything worked correctly.