perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: PerlChildInitHandler => s/VOID/RUN_ALL/
Date Thu, 08 Sep 2005 00:13:59 GMT
Geoffrey Young wrote:
> Stas Bekman wrote:
>>At the moment Child(Init|Exit) phases are of type VOID, i.e. any
>>failures are ignored, which sucks, since you now can't do any reliable
>>initialization in the child init phase (e.g. let's say Apache::DBI's
>>child_init phase fails). 
> a call to die() shouldn't be ignored.  that's the typical way to exit from
> void phases.

It doesn't work in Child(Init|Exit) phases. Not only it doesn't exit, it 
doesn't even log the error. See the test in my patch. Add die in 
child_init() and you will see.

It does work in filters.

>>How about making it RUN_ALL instead? The
>>immediate gain is that errors are now logged. I don't see any problems
>>with backwards compatibility, besides ChildInit phases needing to return
>>OK or DECLINED, but most likely there were all doing so anyway.
> what's the rationale for making this phase RUN_ALL but leaving the other
> VOID phases as is?  if die() works then there is an exit strategy for the
> VOID phases.  if die() isn't logged, that's something we ought to fix, not
> necessarily by changing the runtime prototype to RUN_ALL, though.

see above

> also, I'm in favor of keeping these phases programmatically aligned with httpd.

The fact that httpd ignores the child_init() return value is a problem 
that needs to be fixed.

>>The only problem I have is how to prevent from Apache to continue on
>>failure. Any ideas?
> I'm not sure that it makes sense to halt apache on failure in these phases.
>  you want to shut httpd down if a PerlChildExitHandler fails?  these aren't
> part of startup processing so I don't see how they could prevent apache from
>  starting.

While I somewhat agree about ChildExit, but not about ChildInit. I'm not 
talking hypotethically. I want to use ChildInit for efficiency reasons, 
and sometimes things fail, and I have no way to prevent the server from 
happily starting.

The ChildExit is a whole different story, since httpd will kill the server 
w/o letting it complete its cleanup handlers, which I've reported like 4 
years ago, but nobody wants to deal with that. The fact is, you can't do 
any reliable process shutdown cleanups in Apache/mod_perl at the moment. 
But let's not get offtopic on the other issue.

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message