Hi Stas
Stas Bekman wrote:
yep, that closes the connection after $timeout_secs and looks to me like the right solution.
However, If I try to stop apache it exits with 'Segmentation fault' (in case a timeout occured),
seems due to the fact that the perl code haven't had a chance to clean up. Can I trap this timeout ?
I don't think you can. I think this API is not really used by anyone, hence no wonder if it causes a segfault. Can you post a backtrace?
how can I do that ? Strace with $r->server->timeout(1) :
You mean how to get a corefile backtrace? It's explained here: http://perl.apache.org/docs/1.0/guide/help.html#How_to_Report_Problems
Did you set the perl trap as well? You shouldn't if you set Apache's timeout already. Just wrap $apr->param in eval {}; in the above snippet to trap the failure.
Yep, I tried to eval $apr->request, as well as eval the whole block including the code which sets and restores the timeout
1. sub handler ($$) { my $orig_timeout = $r->server->timeout(1); eval { $apr->param }; $r->server->timeout($orig_timeout_secs); warn "-------", $@, $!; }
2. sub handler ($$) { eval { my $orig_timeout = $r->server->timeout(1); $apr->param; $r->server->timeout($orig_timeout_secs); } warn "-------", $@, $!; }
both ways do not work :(((
(1) looks good. Of course you need to send 'content-type', return OK and such, so I'm not sure what do you mean when you say "do not work". Does it segfault?
[...]BTW, what happens if you set the Apache alarm to 0, does it still set it? Can you try:
my $orig_timeout = $r->server->timeout(0); $apr->param;
and then strace to see whether it sets it at all. I guess we can look at the source code, but strace is more fun ;)
all the alarms I got via strace:
alarm(300) = 0 read(3, "------------5dcexM6YlOS1TIaELqOT"..., 4096) = 664 alarm(0) = 300 alarm(300) = 0 read(3, <unfinished ...>
so if you set it to 0, it uses the default 300 value.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html