httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: latest redhat rpm of apache
Date Fri, 02 Jan 1998 18:05:46 GMT


On Fri, 2 Jan 1998, Ben Laurie wrote:

> Dean Gaudet wrote:
> > 
> > Actually when I mailed ewt@redhat.com about the kill -9 problem he
> > asked me if there was any way for him to know the daemon had died.
> > I said there wasn't and was there another daemon that behaved in a way he
> > liked 'cause I could emulate it.  He said nope, it's a general problem,
> > a solution would be great.  So here's my proposed solution.
> > 
> > After setting up the pid file the parent acquires a sharable lock on it.
> > (The parent exits if the lock fails).  Each child also child acquires
> > a sharable lock.  flock() or fcntl() will work for this.
> > 
> > A support utility "waitlock filename timeout" attempts to acquire an
> > exclusive lock on filename.  Once it has acquired the exclusive lock
> > it exits with code 0.  On any error it exits with code 1, on timeout it
> > exits with code 2.
> 
> Hang on - how is it going to ever acquire an exclusive lock? The parent
> is still holding a shared lock! I presume you have a model along the
> lines of:

The parent doesn't exit until after it's spent a whack of time in
reclaim_child_processes() brutally killing off all the children.  So all
the children have released their locks and died, then the parent releases
its lock and dies.  Then waitlock is able to acquire an exclusive lock.

Dean


Mime
View raw message