1

I used Docker for Selenium Grid Hub and Nodes to collect data, including

  • selenium/hub: 3.141.59-iron
  • selenium/node-fire_fox 3.141.59-iron

but one day after running, selenium-hub hung the following exception:

INFO exited: selenium-hub (exit status 137; not expected)

selenium/node-fire_fox exception is:

INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to selenium-hub/172.24.0.2:4444

What should I do?

happy_code
  • 11
  • 5

2 Answers2

2

This is not a problem related to Selenium, but an issue with Docker.

The following link has a summary of root causes for the error exit status 137; not expected:

In short, for some reason, Docker is killing the process, in your case, selenium-hub.

For Mac and Windows, you probably need to increase the memory dedicated to Docker in Docker preferences.

This answer here on SO has a screenshot showing how to do it.

Tom
  • 1,387
  • 3
  • 19
  • 30
0

If you are using docker I don't understand why are you leaving you hub up and running.

Check out their hub page: https://github.com/SeleniumHQ/docker-selenium/tree/master/Hub

Hub launch: docker run -d -p 4444:4444 --name selenium-hub selenium/hub

Nodes launch:

$ docker run -d --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome
$ docker run -d --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-firefox

I would write a pipeline and define my hub image and node images which I bring up at the beginning of the test session and remove the images at the end of the session.

try {
    hubimage
    nodeimage
    runtests
} catch(anything) {
    throw anything;
} finally {
    sh "docker rmi \$(docker inspect --format='{{range .RepoTags}} {{.}} {{end}}' ${hubimage});"
    sh "docker rmi \$(docker inspect --format='{{range .RepoTags}} {{.}} {{end}}' ${nodeimage});"
}

See more information about pipelines on https://jenkins.io/doc/book/pipeline/.

Tom
  • 1,387
  • 3
  • 19
  • 30
teddym6
  • 88
  • 9
  • Thank you. This is my first question at stackoverflow. I used python-selenium to collection data, In order to maintain stability, I maintain a driver. If I encounter an exception, I exit and retrieve the driver. But one day later, hub died. I've probably understood the pipeline you're talking about, but maybe I'm not very suitable for it. In fact, the purpose of my project is to use headless Firefox to continuously collect website data. Maybe I am too complicated. – happy_code Apr 10 '19 at 07:12