mp2: does not get alarm timeout

[prev] [thread] [next] [Date index for 2004/11/29]

From: Shreeguru KS
Subject: mp2: does not get alarm timeout
Date: 05:42 on 29 Nov 2004
Hi,

I'm using mod_perl 2.0 with apache server 2.0.52 and perl version
5.8.0. The problem is that with mod_perl alarm() doesn't get timeout
through apache mod_perl. It works fine on the command with perl 5.8.0.
It also works with cgi.

The script is given below. Could somebody let me know what's going
wrong here. I read about safe signals and one of the suggested
solutions was to use POSIX signals. Still it doesn't work.

#!/opt/perl/bin/perl
use strict;

use POSIX qw(SIGALRM);
print "Content-type: text/html\n\n";

  eval {
      POSIX::sigaction(SIGALRM,
                       POSIX::SigAction->new(sub { die "alarm" }))
            or die "Error setting SIGALRM handler: $!\n";
      alarm 1;
        my_code();
      alarm 0;
  };
  die "the operation was aborted" if $@ and $@ =~ /alarm/;

sub my_code {
   for (1..100000) {
      print "$_\n";
   }
}

Thanks,
Shreeguru.

        -- 
        Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

mp2: does not get alarm timeout
Shreeguru KS 05:42 on 29 Nov 2004

Re: mp2: does not get alarm timeout
Stas Bekman 15:55 on 29 Nov 2004

Re: mp2: does not get alarm timeout
Stas Bekman 17:34 on 29 Nov 2004

Re: mp2: does not get alarm timeout
Stas Bekman 00:02 on 30 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52