System details
RStudio Edition : Desktop
RStudio Version : 1.3.944
OS Version : macOS Catalina 10.15.4
R Version : R-devel (2020-04-18 r78249)
Steps to reproduce the problem
cl <- parallel::makeCluster(1)
Same if the number of nodes is > 1.
Describe the problem in detail
I have got a (so far) unpublished R package using MC simulations that suddenly did not work anymore. Every time when I tried to start the simulation RStudio went to 100 % CPU load and did nothing anymore. Sometimes, in particular, during the first seconds, I could press the 'stop' button to shutdown the R process. If I waited too long, I had to kill the RStudio process. I narrowed down the problem to the single code line shown above. However, plain R (in the terminal or the R GUI) does work without any problem. I did run the following combinations:
R version | R Studio (1.3.938) | R Studio (1.3.944) | R Studio (1.2.5042)
----------|-----------------|--------------------| -------------------|
R-devel | FREEZE | FREEZE | FREEZE | FREEZE |
R 4.0 RC | NA | FREEZE | FREEZE |
R 3.6.3 | NA | OK | NA
NA: not tested.
My best guess is that this issue is related to recent changes in 'parallel'
Important (and again), it works in the R terminal and the normal R GUI, so, therefore, I believe that something needs to be modified in RStudio (I might be wrong though). Side note: If I used the RStudio check and build functionality where I also test examples, RStudio works fine.
Update 2020-04-24
I realised that FREEZE
is probably not correct, the default timeout for the connection between master and worker in parallel::makeCluster()
is two minutes. If you wait the full time, R will throw the following error message :
> cl <- parallel::makeCluster(2)
Error in makePSOCKcluster(names = spec, ...) :
Cluster setup failed. 2 of 2 workers failed to connect.
Describe the behaviour you expected
Calling
cl <- parallel::makeCluster(1)
does not freeze RStudio or fails with the mentioned error message.
Update 2020-04-26, potential intermediate work-around
Since I had to continue testing with R 4.X and I wanted to use RStudio*, I played a little bit with the parameters, and (at least on my machine), I figured out the following:
If I use the parameter setup_timeout
and set it to < 1 s, it still works. Example:
cl <- parallel::makeCluster(10, setup_timeout = 0.5)
I tested up to 100 nodes, without any problem. Obviously this is not a fix, and it may be different on other machines (not to mention that one may want to have these longer timeouts). However, it may provide an intermediate solution until a fix can be provided. Values > 1 s consistently did not work for me, according to the manual entry for parallel::makeCluster
the default is 2 min.
- [X] I have read the guide to submitting good bug reports at https://github.com/rstudio/rstudio/wiki/Writing-Good-Bug-Reports .
- [X] I have installed the latest version of RStudio and confirmed that the issue still persists.
- [ ] If I am reporting a RStudio crash, I have included a diagnostics report. https://support.rstudio.com/hc/en-us/articles/200321257-Running-a-Diagnostics-Report
Not applicable, it does not really crash.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
bug