perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@ectoplasm.org>
Subject Re: PerlChildInitHandler => s/VOID/RUN_ALL/
Date Thu, 08 Sep 2005 01:42:45 GMT
Stas Bekman wrote:
> Geoffrey Young wrote:
> 
>>> 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.
>>
>> ok, that's problematic - anyplace you call die() from perl-land ought to
>> show up in the logs.  the current behavior is bad (tm).
> 
> Right.
> 
>> but if by exit you mean stop server startup, are you sure that's possible
>> within the confines of httpd?  in prefork you might get no children ever
>> available to receive requests, but I'm not sure that you could make
>> apachectl return an error.  are you?
> 
> That's why I ask. But not exiting is not an option. Not everybody checks
> error_log for problems, and some people have too much noise in those
> files to see something useful.
> 
>>> The fact that httpd ignores the child_init() return value is a problem
>>> that needs to be fixed.
>>
>> ok.  and we can theoretically not ignore it in mod_perl-land.  but
>> what do
>> we do from it?  we can issue croaks all day, but can we make httpd
>> startup
>> stop within the child_init() callback currently?
> 
> I know, hence the question. I suppose the only option is to fix httpd.
> 
> Why httpd aborts on errors during the config, open_logs or post_config
> phase, but not child_init? It sounds like an emission to me, since
> child_init is very similar to any of preceeding to it phases.

Except child_init() is being run _in_ the newly started child, ain't it ?
At that point, aborting is not possible anymore without a mechanism to
notify the parent.

>>>>> 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.
>>
>> ok, but that's a httpd issue, not a mod_perl one, right?  

If things fail, trap the failure and use log_error and variants to loudly
complain in the error_log

> It's a mod_perl too, since at the moment die() called don't log their
> error messages in error_log, but are simply ignored. (again see my test).

That's _bad_ for sure, should make it somewhere, not dissapear

>> again, unless
>> httpd gives us a mechanism to halt the startup process it's kinda out
>> of our
>> hands.  unless you're saying httpd has a formal mechanism in place we can
>> use.  if it doesn't I'd say we either need to offer a patch to httpd and
>> make things right going forward, or live with what httpd gives us.
> 
> I suppose the trickiness of this issue is that child_init runs in the
> child process. So in order to prevent the server from starting, it needs
> to somehow signal the problem to the parent problem, which given the
> multitude of MPMs (where I think the child_init is called from) it might
> be not so trivial.

Yeah, and the fact that there is no good API for that. It's the same reason
we have had trouble implementing child_terminate() proprely.

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Mime
View raw message