Hi. In order to be able to run swiftiply_mongrel_rails under daemontools
I
patched swiftiply_mongrel_rails to use Ara’s Slave library. The patch
does
essentially this:
slaves = []
3.times do |i|
require 'slave'
require "#{File.dirname(__FILE__)}/mongrel_rails"
slaves << Slave.object(:async => true) {
Mongrel::Runner.new.run(args) # args == similar to mongrel_rails
# command line args
}
end
slaves.each {|t| t.join}
(See
http://rubyforge.org/pipermail/swiftiply-users/2007-August/000054.html
for the actual patch).
Note that Mongrel::Runner.new.run never returns, hence the use of the
:async
option. It is just a wrapper around mongrel_rails.
When a SIGTERM is sent to the swiftiply_mongrel_rails process, the
following
output is seen:
http://pastie.caboo.se/88665
This shows swiftiply_mongrel_rails as well as its slaves exiting, and
daemontools subsequently restarting swiftiply_mongrel_rails.
Now for the problem: after this, /tmp holds 3 slave_proc_* UNIX domain
sockets
that have not been unlinked. Subsequent restarts yield more slave_proc_*
sockets, and so on.
So my question is: what could cause these sockets not to be removed? am
I
using Slave incorrectly? I instrumented slave.rb to make sure the
Kernel.at_exit method is called and it is - it’s just that the
associated
block isn’t executed in the SIGTERM case. It works fine when a SIGUSR2
signal
is sent - the sockets are cleaned up as expected. A simple test script
suggests that Kernel.at_exit works okay on the platform (ruby 1.8.5 from
the
CentOS testing repo on CentOS 4).
Any help is appreciated…