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

Henrik Bengtsson henrik.bengtsson at gmail.com
Wed Oct 26 04:44:22 CEST 2016


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?

/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)



More information about the R-devel mailing list