Aleksandr Guidrevitch wrote:
Hi, Stas

   # working around buggy opera multipart/form-data
   eval {
       local $SIG{ALRM} =
           sub { die "Sorry timed out. Please try again\n" };
       alarm 1;
       $apr->param;
       alarm 0;
   };
   warn "works ok\n";

It doesn't work :( Any other suggestions ?

I suppose that SIGALRM works properly with perl functions which may block, for example this one liner blocks (if you don't touch the keyboard):


% perl -le '<STDIN>'

and this does the right thing:

% perl -le 'eval { $SIG{ALRM} = sub { die "skipping read" }; alarm 2; \
            <STDIN>; alarm 0;}; warn "failed: $@" if $@'
failed: skipping read at -e line 1.

Looks like even an external blocking command can be alarmed:

# blocking forever
% perl -le ' qx[tail -F /tmp/whatever]'
tail: /tmp/whatever: No such file or directory

# unblocked in 2 secs
% perl -le 'eval { $SIG{ALRM} = sub { die "skipping read" }; alarm 2; \
            qx[tail -F /tmp/whatever]; alarm 0;}; warn "failed: $@" if $@'
tail: /tmp/whatever: No such file or directory
failed: skipping read at -e line 1.

I suppose that since $apr->param is an XSUB perl decides that it's unsafe to interrupt it. Or may be it's an OS issue, so perl doesn't even get a chance to intervene.

Have you tried strace(1)ing httpd and seeing where does it hang? Of course start the server with -X so you have only one pid to track.

__________________________________________________________________
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



Reply via email to