Sanjay has asked for the wisdom of the Perl Monks concerning the following question:
eval timeout varies by activity in Perl on Windows.
When OPTION1 in the code below is un-commented, then it times out in 10 seconds every time. Even when run simultaneously in different windows.
OPTION2 is a system call to run a program. It times out in 179 to 182 seconds. When run simultaneously, it times out in 240 to 260 seconds.
All the while the system is (almost) doing nothing apart from this.
CPU & memory both below 100% all through.
I want to have a predictable timeout. A few seconds off is tolerable. An order of magnitude is a severe problem.
Any help appreciated.
use strict; use warnings; my $v_bg_tm = time(); # Just before eval call eval { local %SIG; $SIG{ALRM} = sub { die "Timeout after 10 seconds!\n"; }; alarm 10; # sleep 20; # OPTION 1 - Timeout in 10 seco +nds # `lp_solve lp_Gnrtd-470-Hdr_32.lp`; # OPTION 2 - Timeout in 180+ se +conds alarm 0; }; print time() - $v_bg_tm , " seconds used against timeout of 10 seconds +\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: inconsistent eval timeout (updated)
by haukex (Archbishop) on Oct 31, 2019 at 15:25 UTC | |
|
Re: inconsistent eval timeout
by vr (Curate) on Oct 31, 2019 at 18:48 UTC | |
by Sanjay (Sexton) on Nov 04, 2019 at 15:45 UTC | |
by vr (Curate) on Nov 05, 2019 at 10:37 UTC | |
|
Re: inconsistent eval timeout
by NERDVANA (Priest) on Nov 02, 2019 at 06:20 UTC | |
by Sanjay (Sexton) on Nov 04, 2019 at 15:22 UTC | |
|
Re: inconsistent eval timeout
by Anonymous Monk on Nov 01, 2019 at 08:25 UTC |