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";

In reply to inconsistent eval timeout by Sanjay

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.