Two processes, A and B, try to use Headless.new().
Process A "wins" and gains the lock on /tmp/.X-#{display}-lock
Process B loses. Xvfb errors and exits immediately.
ensure_xvfb_is_running calls xvfb_running?
xvfb_running? finds a display lock file, and thinks it's ours. It
erroneously reports that our process is running.
Then, Headless goes on using that display number, even though it's not the process we started. Even if we set resuse: false.
When process A destroys its Xvfb, all of process B's X11 programs die unexpectedly.
When using Selenium, this usually expresses itself as an EOFError. The Selenium web driver loses its connection to the web browser when it's killed.
Here's what can happen:
Then, Headless goes on using that display number, even though it's not the process we started. Even if we set
resuse: false
. When process A destroys its Xvfb, all of process B's X11 programs die unexpectedly.When using Selenium, this usually expresses itself as an EOFError. The Selenium web driver loses its connection to the web browser when it's killed.