[Mongrel] Why not ignore stale PID files?

Erik Hetzner erik.hetzner at ucop.edu
Fri Jun 6 13:48:19 EDT 2008


At Thu, 5 Jun 2008 16:08:06 -0500,
Gunnar Wolf <gwolf at gwolf.org> wrote:
> Hi,
> 
> I have an application which is dying horrible deaths
> (i.e. segmentation faults) in mid-flight, in production... And of
> course, I should fix it. But while I find and fix the bugs, I found
> something I think should be different - I can work on submitting a
> patch, as it is quite simple, but I might be losing something on my
> rationale. 
>
> […]

I use the following bit in my Capistrano scripts before I start
Mongrel:

( [ -f pid_file ] && ( kill -0 `cat pid_file` >& /dev/null || rm pid_file ) )

which handles the typical cases (in which no process with a given pid
is running, or a process is running with a different owner from the
mongrel owner) but not the edge case where a process is running, with
the same owner, but is no longer a mongrel process. You could
supplement this with Linux/Solaris specific stuff to check if the
process running is actually a mongrel.

best,
Erik Hetzner
-------------- next part --------------
;; Erik Hetzner, California Digital Library
;; gnupg key id: 1024D/01DB07E3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/mongrel-users/attachments/20080606/48d231e3/attachment.bin>


More information about the Mongrel-users mailing list