[Rd] setTimeLimit sometimes fails to terminate idle call in R
Jeroen Ooms
jeroen.ooms at stat.ucla.edu
Thu May 16 20:12:50 CEST 2013
I would like to use setTimeLimit to abort operations that are stuck
waiting (idle) after n seconds. Below a toy example in which Sys.sleep
is a placeholder call that is idle:
testlimit <- function(){
setTimeLimit(elapsed=3, transient=TRUE);
Sys.sleep(10);
}
system.time(testlimit());
However this is giving inconsistent results. On windows and in
r-studio server (linux) the call is correctly aborted after 3 seconds.
However, when I run this in a terminal session in either on linux or
osx, the timeout is not triggered until after Sys.sleep() returns and
the total script takes 10+ seconds to complete.
What causes this difference? Is there something I can set in my
terminal R session such that the time limit is triggered? I am using
Ubuntu 13.04 (x64), and osx 10.8. Below three videos to illustrate the
issue:
[1]: http://www.youtube.com/watch?v=d1qxbp2W2mY&hd=1
[2]: http://www.youtube.com/watch?v=S0r-O9er4kU&hd=1
[3]: http://www.youtube.com/watch?v=2D7TgtXUa3o&hd=1
> sessionInfo()
R version 3.0.1 RC (2013-05-10 r62729)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
More information about the R-devel
mailing list