Eval not reseting

C

Cosmic Cruizer

I'm trying to use the follow eval statement in a sub. The first time
through it works fine, but the second time it fails to timeout. I'm trying
to run it on a Solaris box with Perl v5.6.1. It looks like patch 11510
"eval 'format foo=' would loop indefinitely" has alrady been applied. Any
suggestions? I'm not going to be able to upgrade the version of Perl on
this box.

eval {
sigaction(SIGALRM, POSIX::SigAction->new("main::alrm"));
alarm 10; # Timeout after x seconds
@rpcinfo = `rpcinfo -p $server_address`;
alarm 0;
};


Thanks
 
C

castillo.bryan

What happens on your system if you do this?

eval {
$SIG{ALRM} = sub { die "alarm" };
alarm 1; # Timeout after x seconds
@rpcinfo = `sleep 500`;
alarm 0;
};
 
C

Cosmic Cruizer

(e-mail address removed) wrote in @g47g2000cwa.googlegroups.com:
What happens on your system if you do this?

eval {
$SIG{ALRM} = sub { die "alarm" };
alarm 1; # Timeout after x seconds
@rpcinfo = `sleep 500`;
alarm 0;
};

Gave it a try, but it did not make any difference. I also tried setting
sleep to 50 to see what would happened. The first time through took about
one second, then it took about 50 seconds for the next four.
 
C

Cosmic Cruizer

I'm trying to use the follow eval statement in a sub. The first time
through it works fine, but the second time it fails to timeout. I'm
trying to run it on a Solaris box with Perl v5.6.1. It looks like
patch 11510 "eval 'format foo=' would loop indefinitely" has alrady
been applied. Any suggestions? I'm not going to be able to upgrade the
version of Perl on this box.

eval {
sigaction(SIGALRM, POSIX::SigAction->new("main::alrm"));
alarm 10; # Timeout after x seconds
@rpcinfo = `rpcinfo -p $server_address`;
alarm 0;
};


Thanks


Found the problem (kind of...). Tried the script on a different Solaris box
that's running Perl v. 5.005_03. The script runs without any problems.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top