arknoll / ansible-role-selenium

Ansible Role Selenium
https://galaxy.ansible.com/list#/roles/4340
Other
20 stars 52 forks source link

Selenium doesn't always start/stop/restart on Debian #2

Open geerlingguy opened 9 years ago

geerlingguy commented 9 years ago

I had to kill Selenium and start/stop it manually (using java -jar /path/to/selenium) today because the init script seemed to get out of whack on Debian. Running service selenium start reported success, but selenium didn't start (status reported it was stopped). And stop reported it was stopped as well.

I will try to dig into this more in a bit, as I'm currently debugging some Behat tests and can't dig into the selenium problem yet.

geerlingguy commented 9 years ago

Steps to reproduce:

  1. Restart VM/computer with selenium installed.
  2. sudo service selenium status returns "is running"
  3. Run sudo service selenium stop (reports "stopping selenium server")
  4. sudo service selenium status returns "is not running"
  5. Run sudo service selenium start (reports "starting selenium server")
  6. sudo service selenium status returns "is not running"

At this point, ps aux | grep java shows that there is an active instance of selenium running, so it seems the pid or something else is not being tracked correctly.

kostajh commented 8 years ago

I'm seeing the same issue.

BrianGilbert commented 8 years ago

Confirming this is still occurring

AlexSkrypnyk commented 8 years ago

The root of the problem is that the created PID is not a PID of the selenium process.

The reason is that service starting command does not start selenium directly, but rather starts xvfb (/usr/bin/xvfb-run), which in its turn starts selenium. The stored PID in /opt/selenium/selenium.pid file is actually a PID of xvfb. Calling selenium service stop stops xvfb, but does not stop selenium.

In the snippet output from ps ax, the PID of selenium is 15285, but selinum.pid file contains the value of 15268.

15268 ?        S      0:00 /bin/sh /usr/bin/xvfb-run /usr/bin/java -client -ja
15282 ?        Sl     0:00 Xvfb :101 -screen 0 640x480x8 -nolisten tcp -auth /
15285 ?        Sl     0:03 /usr/bin/java -client -jar /opt/selenium/selenium-s

Calling service selenium stop does not stop selenium's process:

15282 ?        Sl     0:00 Xvfb :101 -screen 0 640x480x8 -nolisten tcp -auth /
15285 ?        Sl     0:03 /usr/bin/java -client -jar /opt/selenium/selenium-s
geerlingguy commented 7 years ago

If running on Debian 8, there's now a unit file to control restart behavior... this issue might be solved by updating to the latest version of this role. I don't have time to test right now, but the issue should be solved on Debian 8, CentOS 7, and Ubuntu 16.04 the same. See: https://github.com/arknoll/ansible-role-selenium/pull/23

ArtuGit commented 7 years ago

I have the same issue in my Debian 8 standalone server. I can not catch on anything in this topic to solve this issue.

Is it working way to start Selenium using java -jar /path/to/selenium? It works, but I have another issue with Chrome starting,

ArtuGit commented 7 years ago

I have this error:

TASK [arknoll.selenium : Register systemd service status (for systemd systems)] **************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "systemctl status selenium | grep \"active (running)\"", "delta": "0:00:00.086507", "end": "2017-08-21 10:47:13.798168", "failed": true, "rc": 1, "start": "2017-08-21 10:47:13.711661", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
...ignoring