You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/12/10 03:07:43 UTC
[mp2] callback returning bogus error code don't log the error
Found a new problem. If the callback returns a bogus error code, no
error is logged, but 500 is sent.
For example:
Index: t/hooks/TestHooks/push_handlers.pm
===================================================================
--- t/hooks/TestHooks/push_handlers.pm (revision 111452)
+++ t/hooks/TestHooks/push_handlers.pm (working copy)
@@ -38,7 +38,7 @@
}
sub end { return Apache::DONE }
-sub say { shift->print(shift,"\n"); return Apache::DECLINED }
+sub say { shift->print(shift,"\n"); 12345 }
sub conf {
# this one is configured from httpd.conf
just sends 500 to the client, nothing in the logs.
This brings us to a more painful problem. the code in startup.pl:
$s->push_handlers(PerlPostConfigHandler => sub { 12345 });
won't let the server start, and no error is logged, the server just
quits.
---------------
probably unrelated, but when tracing this test I got:
modperl_handler_resolve: [8896/1107602352 rabbit.stason.org:8529] handler
TestHooks::push_handlers::conf was not compiled at startup, attempting to
resolve using current pool 0x9f71a40
modperl_callback_run_handlers: TestHooks::push_handlers::conf returned 12345
modperl_callback_run_handlers: error status 12345 leaves 1078468780
uncalled handlers
"1078468780 uncalled handlers" - wow, that's a lot :)
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] callback returning bogus error code don't log the error
Posted by Stas Bekman <st...@stason.org>.
OK, so I've committed a change which does the following for
open_logs|post_config:
- if there is an error in running the handler, it gets logged as before
- otherwise if the return code is not OK, an appropriate error is logged
as well
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] callback returning bogus error code don't log the error
Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> Stas Bekman wrote:
>
>> Philippe M. Chiasson wrote:
>>
>>> Stas Bekman wrote:
>>>
>>>> Stas Bekman wrote:
>>>>
>>>>> [...] This brings us to a more painful problem. the code in
>>>>> startup.pl:
>>>>>
>>>>> $s->push_handlers(PerlPostConfigHandler => sub { 12345 });
>>>>>
>>>>> won't let the server start, and no error is logged, the server just
>>>>> quits.
>>>
>>>
>>> Actually, you'll get this in the error_log:
>>>
>>> Configuration Failed
>>>
>>> it's from [httpd]/server/main.c:
>>>
>>> if ( ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) {
>>> ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
>>> 0, NULL, "Unable to open logs\n");
>>> destroy_and_exit_process(process, 1);
>>> }
>>>
>>> if ( ap_run_post_config(pconf, plog, ptemp, server_conf) != OK) {
>>> ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
>>> NULL, "Configuration Failed\n");
>>> destroy_and_exit_process(process, 1);
>>> }
>>>
>>>
>>>> but this is a problem. I can't figure out why the server fails
>>>> (won't start here). I think for post_config phase it absolutely
>>>> wants a valid OK or another return code. Philippe, please take a
>>>> look at the apache source code. I think the answer will be there.
>>>
>>>
>>> See above!
>>
>>
>> But it gives no clue whatsoever where did it fail.
>
>
> It does report "Configuration Failed" in error_log.
Heh, and what you gonna do with that message if you have a dozen of handlers?
>> I think we need to make a special case for open_logs and post_config
>> phases in modperl_callback and require OK or log a proper error.
>
>
> Oh, like say something like "mod_perl handler XXX returned DDD at
> httpd.conf:44, server aborting"
> kinda thing ?
right.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] callback returning bogus error code don't log the error
Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Stas Bekman wrote:
> Philippe M. Chiasson wrote:
>
>> Stas Bekman wrote:
>>
>>> Stas Bekman wrote:
>>>
>>>> [...] This brings us to a more painful problem. the code in startup.pl:
>>>>
>>>> $s->push_handlers(PerlPostConfigHandler => sub { 12345 });
>>>>
>>>> won't let the server start, and no error is logged, the server just
>>>> quits.
>>
>> Actually, you'll get this in the error_log:
>>
>> Configuration Failed
>>
>> it's from [httpd]/server/main.c:
>>
>> if ( ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) {
>> ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
>> 0, NULL, "Unable to open logs\n");
>> destroy_and_exit_process(process, 1);
>> }
>>
>> if ( ap_run_post_config(pconf, plog, ptemp, server_conf) != OK) {
>> ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
>> NULL, "Configuration Failed\n");
>> destroy_and_exit_process(process, 1);
>> }
>>
>>
>>> but this is a problem. I can't figure out why the server fails (won't
>>> start here). I think for post_config phase it absolutely wants a
>>> valid OK or another return code. Philippe, please take a look at the
>>> apache source code. I think the answer will be there.
>>
>> See above!
>
> But it gives no clue whatsoever where did it fail.
It does report "Configuration Failed" in error_log.
> I think we need to make a special case for open_logs and post_config
> phases in modperl_callback and require OK or log a proper error.
Oh, like say something like "mod_perl handler XXX returned DDD at httpd.conf:44, server aborting"
kinda thing ?
--
--------------------------------------------------------------------------------
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
Re: [mp2] callback returning bogus error code don't log the error
Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> Stas Bekman wrote:
>
>> Stas Bekman wrote:
>>
>>> [...] This brings us to a more painful problem. the code in startup.pl:
>>>
>>> $s->push_handlers(PerlPostConfigHandler => sub { 12345 });
>>>
>>> won't let the server start, and no error is logged, the server just
>>> quits.
>
>
> Actually, you'll get this in the error_log:
>
> Configuration Failed
>
> it's from [httpd]/server/main.c:
>
> if ( ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) {
> ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
> 0, NULL, "Unable to open logs\n");
> destroy_and_exit_process(process, 1);
> }
>
> if ( ap_run_post_config(pconf, plog, ptemp, server_conf) != OK) {
> ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
> NULL, "Configuration Failed\n");
> destroy_and_exit_process(process, 1);
> }
>
>
>> but this is a problem. I can't figure out why the server fails (won't
>> start here). I think for post_config phase it absolutely wants a valid
>> OK or another return code. Philippe, please take a look at the apache
>> source code. I think the answer will be there.
>
>
> See above!
But it gives no clue whatsoever where did it fail.
I think we need to make a special case for open_logs and post_config
phases in modperl_callback and require OK or log a proper error.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp2] callback returning bogus error code don't log the error
Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
Stas Bekman wrote:
> Stas Bekman wrote:
>
>> [...]
>> This brings us to a more painful problem. the code in startup.pl:
>>
>> $s->push_handlers(PerlPostConfigHandler => sub { 12345 });
>>
>> won't let the server start, and no error is logged, the server just
>> quits.
Actually, you'll get this in the error_log:
Configuration Failed
it's from [httpd]/server/main.c:
if ( ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) {
ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
0, NULL, "Unable to open logs\n");
destroy_and_exit_process(process, 1);
}
if ( ap_run_post_config(pconf, plog, ptemp, server_conf) != OK) {
ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
NULL, "Configuration Failed\n");
destroy_and_exit_process(process, 1);
}
> but this is a problem. I can't figure out why the server fails (won't
> start here). I think for post_config phase it absolutely wants a valid
> OK or another return code. Philippe, please take a look at the apache
> source code. I think the answer will be there.
See above!
>> probably unrelated, but when tracing this test I got:
>>
>> modperl_handler_resolve: [8896/1107602352 rabbit.stason.org:8529]
>> handler TestHooks::push_handlers::conf was not compiled at startup,
>> attempting to resolve using current pool 0x9f71a40
>>
>> modperl_callback_run_handlers: TestHooks::push_handlers::conf returned
>> 12345
>>
>> modperl_callback_run_handlers: error status 12345 leaves 1078468780
>> uncalled handlers
>>
>> "1078468780 uncalled handlers" - wow, that's a lot :)
>
>
> this was a broken format string, now fixed in svn.
>
--
--------------------------------------------------------------------------------
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
Re: [mp2] callback returning bogus error code don't log the error
Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Found a new problem. If the callback returns a bogus error code, no
> error is logged, but 500 is sent.
>
> For example:
>
> Index: t/hooks/TestHooks/push_handlers.pm
> ===================================================================
> --- t/hooks/TestHooks/push_handlers.pm (revision 111452)
> +++ t/hooks/TestHooks/push_handlers.pm (working copy)
> @@ -38,7 +38,7 @@
> }
>
> sub end { return Apache::DONE }
> -sub say { shift->print(shift,"\n"); return Apache::DECLINED }
> +sub say { shift->print(shift,"\n"); 12345 }
>
> sub conf {
> # this one is configured from httpd.conf
>
> just sends 500 to the client, nothing in the logs.
which is OK, since there is no error in the code, it just returns a
non-existing error code.
> This brings us to a more painful problem. the code in startup.pl:
>
> $s->push_handlers(PerlPostConfigHandler => sub { 12345 });
>
> won't let the server start, and no error is logged, the server just
> quits.
but this is a problem. I can't figure out why the server fails (won't
start here). I think for post_config phase it absolutely wants a valid OK
or another return code. Philippe, please take a look at the apache source
code. I think the answer will be there.
> probably unrelated, but when tracing this test I got:
>
> modperl_handler_resolve: [8896/1107602352 rabbit.stason.org:8529]
> handler TestHooks::push_handlers::conf was not compiled at startup,
> attempting to resolve using current pool 0x9f71a40
>
> modperl_callback_run_handlers: TestHooks::push_handlers::conf returned
> 12345
>
> modperl_callback_run_handlers: error status 12345 leaves 1078468780
> uncalled handlers
>
> "1078468780 uncalled handlers" - wow, that's a lot :)
this was a broken format string, now fixed in svn.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org