Reputation: 33
Server side
Our Selenium Grid server has public IP-address (104.131.xxx.xxx)
java -jar selenium-server-standalone-3.4.0.jar -role hub
Nodes
There are node computers in the private network (192.168.43.xxx). They are able to connect to the Selenium Server without any problems:
java -jar selenium-server-standalone-3.4.0.jar -role webdriver -hub http://104.131.xxx.xxx:4444/grid/register -port 3456
The issues
3.1 There are repeated messages on the server:
Registered a node http://192.168.43.248:3456
Marking the node http://192.168.43.248:3456 as down: cannot reach the node for 2 tries
Unregistering the node http://192.168.43.248:3456 because it's been down for 60060 milliseconds
Cleaning up stale test sessions on the unregistered node http://192.168.43.248:3456
Registered a node http://192.168.43.248:3456
Marking the node http://192.168.43.248:3456 as down: cannot reach the node for 2 tries
......
3.2 We can't start any test. When we try to start we got:
Got a request to create a new session: Capabilities [{marionette=true, loadImages=false, acceptInsecureCerts=true, browserName=firefox}]
Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=firefox, maxInstances=5, platform=WIN10}
Marking the node http://192.168.43.248:3456 as down: cannot reach the node for 2 tries
Unregistering the node http://192.168.43.248:3456 because it's been down for 60050 milliseconds
Cleaning up stale test sessions on the unregistered node http://192.168.43.248:3456
Removed a session that had not yet assigned an external key f83395be-cb27-43a3-8999-b5573f387715, indicates failure in session creation PROXY_REREGISTRATION
Registered a node http://192.168.43.248:3456
Marking the node http://192.168.43.248:3456 as down: cannot reach the node for 2 tries
3.3 The test's trace:
selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Error forwarding the request Connect to 192.168.43.248:3456 [/192.168.43.248] failed: Connection timed out (Connection timed out)
Should we create VPN-network or Selenium Grid has some special way to manage this issues?
P.S. When we move the Selenium Server to the local environment everything works.
Upvotes: 2
Views: 4830
Reputation: 14746
The main issue is not with the node not being able to register itself with the hub, but the problem is that the Hub's pinging (the Hub keeps sending heartbeat signals to the nodes at predetermined intervals to check if the nodes are up or if they are down) is not reaching the nodes. I am guessing that this is perhaps due to the fact that the Hub and the nodes are on different networks and so the two way communication is not happening.
This is very similar to me running a Selenium Hub on an Amazon Cloud machine and have it exposed to the outside world and then trying to spawn a Selenium Node on my local machine (which also has internet connectivity) and trying to wire in this node to the Hub.
The registration from the node to the hub will work because my machine (on which the node runs) is able to discover the Hub running on the cloud (and which is exposed outside), but when the Hub tries to send heartbeat signals to my node, the attempt fails because my machine would have sent it's internal IP address which is visible only in the local network, but not outside and this is the IP address that the hub would be using to send heartbeat signals.
This is more of a networking problem and has got nothing to do with the Selenium Grid.
The bottom line is, that you need to ensure that both your Selenium Hub and the Selenium Node are on the same network. So you can either have it done via VPN configurations (I am not an network expert so I cannot comment more than this on how to do that) (or) you move your Hub to the same network as that of your nodes.
Hope that adds clarity.
Upvotes: 6