httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mladen Turk" <mt...@apache.org>
Subject RE: Hooking child termination
Date Fri, 12 Sep 2003 17:52:11 GMT


> From: William A. Rowe, Jr.
> >
> >Is there a possibility to add some sort of a hook to a 
> parent that will 
> >execute when the child process dies? I would like to have a config 
> >option that will (something like Windows service manager has for the 
> >services itself) behave differently on first and on the consecutive 
> >failures, either launching sendmail, or shutting down the 
> httpd itself, 
> >or whatever.
> >
> 
> Within the mpm - they way it is determined changes from mpm 
> to mpm. You ask about "the child process" - there may be one, 
> or many.  You will need to decide if this should trigger on 
> each individual child process that "goes away" - perhaps with 
> a useful nugget like that childs' apr_proc_t.
> 

As I see the problem, if the child process exited prematurely then
eventually all of them will at some point.

> But I suggest you take a look at the otherchild logic first.  
> Perhaps we goofed?  Maybe in 2.1 the very best thing would be 
> to treat all worker processes as "just another otherchild"?  
> That seems like it would become alot more extensible.

True. IMO all worker processes should be treated as just one.
If the process (or one of them) dies due to a fatal error, it is just
restarted, meaning that the entire httpd eventually enters in the
launch/exit loop, consuming 100% of cpu.

I was thinking of something like:

ServerOnFatalError 1 restart
ServerOnFatalError 2 /do_something
ServerOnFatalError 3 /do_something
...
ServerOnFatalError n shutdown

First argument is the number of times the worker process has exited with
the fatal error, and the second is the action.
There should also be some sort of the time window when the counter is
reset to 0, like:

ServerFatalErrorTimeout 60


> Again - that logic all belongs in the mpm itself.
> 

Then the logic has to eventually be implemented in each mpm separately?


MT.


Mime
View raw message