Thanks for the quick and prompt reply guys.

> $s->push_handlers as well as $s->add_config modify the server 
> configuration object while $r->... modify the runtime request 
> configuration. The server methods are intended to be used only at 
> startup time (up to PerlPostConfig, perhaps PerlChildInit works too).
>  Later the server configuration must be read-only or you risk
> segfaults at least on a threaded MPM.

This clarifies things. Indeed, using $s->push_handlers at PerlPostConfig
I get consistent behaviour and the cleanup handler is always executed
(even on RH 5). Using $s->push_handlers at a later stage has weird
behaviour.

> The PerlCleanup phase is an artificial thing that is implemented as a
>  pool cleanup function on the request pool. But it needs to be 
> registered on the request pool to be run. If there is no Perl handler
>  in the request cycle the pool cleanup is never installed.

I see. Note that in my tests, a cleanup handler installed on $s is only
executed if another handler is installed *also on $s*. I have a
PerlResponseHandler installed through httpd.conf, then if I install a
cleanup on $r it runs, but on $s it does not. If I add another handler
on $s (eg a PerlPostReadRequestHandler) then cleanup on $s also run.

This does not really affect me (I'll stick to $r anyway), I just thought
to mention it in case it also needs to be fixed.



> Also, all of the above is based on the fact that you do a
> push_handler(), not systematically, but presumably in function of
> certain conditions. ((*)Because otherwise why not just put it into
> your basic configuration, and have it be there all the time ?). I can
> understand easily why one does that within a request. But I have more
> trouble understanding why one would use this at the server level.  It
> means that, depending on some condition, when a new child starts, you
> would or would not add a given handler to it. What would be such a
> condition that would make sense ? From - Fri

I was trying to debug code that uses $s->push_handlers (which I didn't
know what it does) and it looks like it should be using $r. Indeed I
think that $s->push_handlers is for rare cases.


Kostas



Reply via email to