pid file handling issue
mfischer at zendesk.com
Thu Oct 24 01:01:33 UTC 2013
On Wed, Oct 23, 2013 at 5:53 PM, Eric Wong <normalperson at yhbt.net> wrote:
> I read and stash the value of the pid file before issuing any USR2.
> Later, you can issue "kill -0 $old_pid" after sending SIGQUIT
> to ensure it's dead.
That's inherently racy; another process can claim the old PID in the interim.
> Checking the mtime of the pidfile is really bizarre...
Perhaps (though it's a normative criticism), but on the other hand, it
isn't subject to the race above.
> OTOH, there's times when users accidentally remove a pid
> file and regenerate by hand it from ps(1), too...
Sure, but (a) that's a corner case I'm not particularly concerned
about, and (b) it wouldn't cause any problems, assuming the user did
this before any reload attempt, and not in the middle or something.
More information about the mongrel-unicorn