From spencer.graves at prodsyse.com  Wed Oct 26 05:02:29 2016
From: spencer.graves at prodsyse.com (Spencer Graves)
Date: Tue, 25 Oct 2016 22:02:29 -0500
Subject: [Rd] BUG?: On Linux setTimeLimit() fails to propagate timeout
 error when it occurs (works on Windows)
In-Reply-To: <CAFDcVCStodbQMS4TffimW69qvVutCX8FheDNxf1o_Ejpmu9NQg@mail.gmail.com>
References: <CAFDcVCStodbQMS4TffimW69qvVutCX8FheDNxf1o_Ejpmu9NQg@mail.gmail.com>
Message-ID: <21e7967d-866d-11f9-4be6-6261bb120ee5@prodsyse.com>



On 10/25/2016 9:44 PM, Henrik Bengtsson wrote:
> setTimeLimit(elapsed=1) causes a timeout error whenever a call takes
> more than one second.  For instance, this is how it works on Windows
> (R 3.3.1):
>
>> setTimeLimit(elapsed=1)
>> Sys.sleep(10); message("done")
> Error in Sys.sleep(10) : reached elapsed time limit
>
> Also, the error propagates immediately and causes an interrupt after ~1 second;
>
>> system.time({ Sys.sleep(10); message("done") })
> Error in Sys.sleep(10) : reached elapsed time limit
> Timing stopped at: 0.01 0 1.02
>
> This works as expected.  However, on Linux (R 3.3.1 but also e.g.
> 2.11.0, 2.15.3) I get:
>
>> setTimeLimit(elapsed=1)
>> system.time({ Sys.sleep(10); message("done") })
> Error in Sys.sleep(10) : reached elapsed time limit
> Timing stopped at: 0 0 10.01
>
> Note how the timeout error is signaled, but for some reason, it does
> not interrupt the Sys.sleep(10) call until after it finishes after 10
> seconds.  If you change to Sys.sleep(60) it will take 1 minute. Note
> that the following print("done") is not called, so the timeout error
> does propagate immediately after Sys.sleep() but not before / during.
>
> This looks like a bug to me.  Can anyone on macOS confirm whether this
> is also a problem there or not?


 > setTimeLimit(elapsed=1)
 > system.time({ Sys.sleep(10); message("done") })
Error in Sys.sleep(10) : reached elapsed time limit
Timing stopped at: 0.003 0.004 0.978
 >
 > sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils
[5] datasets  methods   base

loaded via a namespace (and not attached):
[1] rsconnect_0.5 tools_3.3.1
Error: reached elapsed time limit

> /Henrik
>
>> sessionInfo()
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows XP x64 (build 2600) Service Pack 3
>
>> sessionInfo()
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 16.04.1 LTS
>
>> sessionInfo()
> R version 2.11.0 (2010-04-22)
> x86_64-unknown-linux-gnu
>
> sessionInfo()
> R version 2.15.3 (2013-03-01)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] BUG?: On Linux setTimeLimit() fails to propagate timeout error when it occurs (works on Windows)
Spencer Graves