I have two apps running on a single server that perform headless browsing tasks. Each time one browses, the Xvfb process is not dying and instead becomes a zombie. I can confirm this with the following script.
require 'headless'
require 'watir-webdriver'
require 'yaml'
zombies_at_start = `ps axo pid=,stat= | awk '$2~/^Z/ { print $1 }'`.split("\n").count
5.times do
begin
d = YAML.load_file("/path/to/config/headless.yml")['build_number'] #=> "98"
h = Headless.new(:display => d)
h.start
b = Watir::Browser.new :firefox
b.goto 'http://google.com'
sleep(0.5)
ensure
b.close
h.destroy
end
sleep(0.5)
end
zombies_at_end = `ps axo pid=,stat= | awk '$2~/^Z/ { print $1 }'`.split("\n").count
puts "Created #{zombies_at_end - zombies_at_start} more zombies."
#=> Created 5 more zombies.
Why? How can I fix this?
Version info:
- xorg-x11-server-Xvfb-1.15.0-26.el6.centos.i686
- CentOS release 6.5 (Final)
- ruby-2.0.0-p353
- rvm 1.25.25
- selenium-webdriver (2.45.0, 2.44.0)
- watir-webdriver (0.7.0)
- headless (2.1.0)