On Sat, 23 Oct 1999, Stas Bekman wrote:

> 
> After investigating deeper into a hanging detection problem, I understood
> that I can quite easily write a monitor that will detect these processes
> and kill them off. I wrote a module Apache::SafeHang with help of
> Apache::Scoreboard that should solve the problem.
> 
> The only problem I have with this module, is that it should be forked from
> the main process after the server has completed the configuration. I've
> tried to fork it during the startup (from startup.pl), but then I don't
> get a valid Apache::Scoreboard image, so it's like starting it from shell.
> Is it possible to execute some perl code in the parent process, a moment
> before a first child starts or any time after that?

if you put your code in a <Perl> section and wait until the second time it
is called, apache will have initialized the scoreboard by then.  if you
use a PerlRequire script, that's only call during the first init-modules
call, before the scoreboard is created.
 
> The third question is again regarding the main process. If I fork the
> process during a startup, when I perform 'apachectl stop' all the
> processes die but the one I've forked. Is there any way to install END{}
> block in the parent main process, so the children wouldn't inherit it?
> Otherwise if they do and it supposed to kill the forked process, a first
> child that quits will kill off the monitor. (I could probably test the pid
> of the process that executes the END block, since I know the pid of the
> parent, I could execute the block only if it's parent process...)

not really, you'd have to put logic in the END routines to do things (or
not do things) based on pid or some other flag.

Reply via email to