leonid-shevtsov / headless

Create a virtual X screen from Ruby, record videos and take screenshots.
http://leonid.shevtsov.me/en/headless
MIT License
968 stars 113 forks source link

Display socket is taken but lock file is missing #80

Closed raumirco closed 7 years ago

raumirco commented 8 years ago

When I run my tests in parallel I am getting the following error: "Failure/Error: Unable to find matching line from backtrace Headless::Exception: Display socket is taken but lock file is missing - check the Headless troubleshooting guide

leonid-shevtsov commented 8 years ago

Does this happen every time? If it's a one time situation, there's a manual fix, but it shouldn't be a recurring thing.

https://github.com/leonid-shevtsov/headless#display-socket-is-taken-but-lock-file-is-missing

reprah commented 8 years ago

This error is recurring for me. I also get it while running tests. What's the manual fix?

headless version: 2.1.0 Xfvb version: from XQuartz 2.7.9 ruby version: 2.3.1 OS: OSX 10.11.4

leonid-shevtsov commented 8 years ago

The manual fix is described here.

Are you doing something else with the XQuartz? And please post your Headless.start arguments.

reprah commented 8 years ago

The manual fix (pkill Xvfb) is a no-op for me - I can't even find a running process named Xvfb (ps aux | grep -i xvfb doesn't show anything).

My arguments to Headless.start:

Headless.new(display: 100, reuse: true, destroy_at_exit: true).start

I also tried it with no options at at all (Headless.new.start) to see if using the defaults was all I needed to do. I get the same exception.

Let me know if I can provide more info or help in any way.

jherdman commented 8 years ago

I see this consistently using the Ubuntu 14 environment on Circle CI. My Headless settings are: Headless.new(reuse: true, destroy_at_exit: false)

yunixon commented 8 years ago

on osx EI Capitan (10.11.6) Xfvb version: from XQuartz 2.7.9 ruby version: 2.3.1

gem uninstall capybara-webkit
brew tap homebrew/versions
brew install qt55
brew linkapps qt55
brew link --force qt55
gem install capybara-webkit

Works fine for me: Headless.new(reuse: false).start

TamerShlash commented 8 years ago

Had this problem too.

Needed to just run Xvfb and/or quartz-wm once and that solved the issue.

Apparently, that created the /tmp/.X11-unix/ folder, not sure if it created something else.

btucker commented 7 years ago

This fixed this issue for me on macOS El Capitan:

mkdir /tmp/.X11-unix
sudo chmod 1777 /tmp/.X11-unix
sudo chown root /tmp/.X11-unix/
SamRaymer commented 7 years ago

☝️ This worked for me using Capybara with Sierra.

garyjohnson commented 7 years ago

This is an issue on every reboot. My assumption is that /tmp is clearing and I have to recreate the file each time. macOS Sierra 10.12.4, XQuartz 2.7.11. (Edit: also worth noting -- this is the only thing i use XQuartz for)

mterezac commented 7 years ago

any updates on this? I also have the same issue on every reboot. Sierra 10.12.6, xquartz 2.7.11

leonid-shevtsov commented 7 years ago

Unfortunately, I can't solve this issue because it's a fundamental X server requirement to have a /tmp/.X11-unix directory and have it owned by root. In addition, since macOS does clean /tmp on reboot, you need to set the directory up every time.

Fortunately, XQuartz.app will do that for you, so a simple solution is to add XQuartz.app to login items.

The only thing I can do is improve the error message, and document the solution here: https://github.com/leonid-shevtsov/headless#tmpx11-unix-is-missing

kevinchugh commented 6 years ago

Installing chromedriver fixed this for me (on a mac brew install chromedriver).

prodoxx commented 5 years ago

@btucker 's fix worked for me.