Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Server doesn't bind to socket after being killed with SIGTERM

After being killed once, selenium server hangs on all further startups without even trying to acquire the server port.

Rebooting fixes the problem. Running as a different user makes selenium start up again as well, but after that process gets killed it won't work no more.

This is on Linux 2.6.32-5-amd64 (debian squeeze) in a VirtualBox VM. Looking at a log of the system calls when it's working and when it's not, some component seems to lock up before the socket is even bound. The selenium log isn't of much help.

The output doesn't give any indication either:

$ java -jar selenium-server-standalone-2.28.0.jar
Dec 27, 2012 5:41:35 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
17:41:35.703 INFO - Java: Sun Microsystems Inc. 14.0-b16
17:41:35.704 INFO - OS: Linux 2.6.32-5-amd64 amd64
17:41:35.737 INFO - v2.28.0, with Core v2.28.0. Built from revision 18309
17:41:35.867 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
17:41:35.868 INFO - Version Jetty/5.1.x
17:41:35.868 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
17:41:35.869 INFO - Started HttpContext[/selenium-server,/selenium-server]
17:41:35.869 INFO - Started HttpContext[/,/]
like image 221
phihag Avatar asked Dec 27 '12 16:12

phihag


1 Answers

This is a Java problem; its RNG needlessly reads from /dev/random. On a VM, the random pool is limited and often exhausted after one or two runs. For some reason, a part of the selenium/Jetty startup asks for the problematic RNG. To fix the problem, advise Java to use /dev/urandom instead:

java -Djava.security.egd=file:/dev/./urandom \
     -jar selenium-server-standalone-2.28.0.jar

works fine.

like image 69
phihag Avatar answered Oct 16 '22 17:10

phihag