intermittent rstudio hangup (rsession at 100% CPU)

For a while, I am experiencing frequent, but unpredictable hangups of my rstudio environment.
These require me to force-quit (I'm on a Mac, 10.14.6 Mojave) Rstudio and restart. The UI is still operational, but no actual actions are executed). I typically notice it when trying to execute some R code, or e.g. trying to save the file I am editing (the source code editor itself keeps working fine)

Due to multiple cores, I did not realize it, but it appears that rsession is eating 99-100% CPU, probably in a loop?
Other errors that may appear at these times:

  • error: node stack overflow (in the Console)
  • error pop-ups such as "Error retrieving help--R code execution error"
  • ".... --unable to establish connection with R session"

Oh, and if I run knitr on the notebook I am working on, there is never an issue..

I have tried a wide range of things:

It is getting really annoying to be interrupted several times a day! Any help/suggestion is appreciated.

below is my session info, I tried to upload a rstudio-sample file, but that does not work...

cheers,
Lodewijk


sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

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 datasets methods base

other attached packages:
[1] SIG.R.Theme_2020.03.03 interp_1.0-33 lattice_0.20-38 lubridate_1.7.4 knitr_1.28
[6] glue_1.3.2 treemapify_2.5.3 scales_1.1.0 gghighlight_0.2.0 RMariaDB_1.0.8
[11] forcats_0.5.0 stringr_1.4.0 dplyr_0.8.5 purrr_0.3.3 readr_1.3.1
[16] tidyr_1.0.2 tibble_2.1.3 ggplot2_3.3.0 tidyverse_1.3.0

loaded via a namespace (and not attached):
[1] tidyselect_1.0.0 xfun_0.12 haven_2.2.0 colorspace_1.4-1 vctrs_0.2.4 generics_0.0.2
[7] yaml_2.2.1 rlang_0.4.5 pillar_1.4.3 withr_2.1.2 DBI_1.1.0 RcppZiggurat_0.1.5
[13] bit64_0.9-7 dbplyr_1.4.2 modelr_0.1.6 readxl_1.3.1 lifecycle_0.2.0 ggfittext_0.8.1
[19] munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0 rvest_0.3.5 labeling_0.3 parallel_3.6.3
[25] fansi_0.4.1 Rfast_1.9.9 broom_0.5.5 Rcpp_1.0.4 backports_1.1.5 jsonlite_1.6.1
[31] farver_2.0.3 deldir_0.1-25 fs_1.3.2 bit_1.1-15.2 digest_0.6.25 hms_0.5.3
[37] stringi_1.4.6 ggrepel_0.8.2 grid_3.6.3 cli_2.0.2 tools_3.6.3 magrittr_1.5
[43] crayon_1.3.4 pkgconfig_2.0.3 ellipsis_0.3.0 xml2_1.2.5 reprex_0.3.0 assertthat_0.2.1
[49] httr_1.4.1 rstudioapi_0.11 R6_2.4.1 nlme_3.1-144 compiler_3.6.3

Have you tried changing to software rendering?, On Windows, you can change it by holding the Ctrl key while opening RStudio, then you should see this menu and change the "Rendering Engine" to "Software". I guess you can do the same on macOS with the key.

Hi, thanks for thinking along: it took me a bit to find out how to do this, but it is just an option in Preferences (see below): I changed it now, will report later on the impact.
cheers,
Lodewijk

Well, after one day of working with at least 10 more hang-ups, it is safe to conclude that that did not make a (significant) difference...

too bad, if anyone has further suggestions it is really appreciated, since this is driving me fairly crazy..

/Lodewijk

Are you using the latest preview version? If not, give it a try and if the problem persist, I think you should file an issue on the GitHub repo

No, I'm on v1.2.5033, and my rstudio version is centrally managed by our IT dept.
I can try to install a preview version as well (next to my existing one).

cheers,
Lodewijk

well, getting the preview version was easy.
the joy however, did not last very long: the same issue is re-appearing..

on to github, then?
/Lodewijk

Yes, just try to follow their "issue guide". Rstudio IDE developers are suscribed to this category but they have limited time to spend here so if you are sure that you are experiencing a software bug, then properly filing a github issue is the best way to get attention.

This often implies an infinite (or deeply-nested) loop being run in R code; perhaps by RStudio behind the scenes, or explicitly by your own R code.

It would help to know if you can provide a reproducible example.

  • Do you have a large number of objects in your R environment (ie: do you have a lot of objects showing in the Environment pane)?

  • Are these objects very large?

  • What kind of objects / packages are you using in your scripts?

Hi,

thanks for your response;

  • I have not been able to find any clear repeating pattern when this issue occurs
  • I am mostly working on one project, so it could be due to that: in my first post I attached sessionInfo() results
  • it does not involve lots of data or objects (lots of plots perhaps)
  • the problem never occurs during the execution of (my) R code (or when knitting the entire notebook), only when editing: then suddenly some menu options such as saving, or running code or a chunk does not start.

Hi I am experiencing a very similar issue to lbergmans as today Rstudio kept getting stuck and I had to use end task manager several times but the same issue kept occurring.

I have tried clearing my objects in the environment plane

Hopefully it should work now if not I will let you guys know.

Theepan

Same problem keeps occurring after a while Rstudio keeps freezing all the time any suggestions on how to stop this from happening? The environment pane is clear as well.

is in your case also the rsession process running at 99-100%?
does it freeze while executing some of your code? or while you are doing other stuff?
(I have no suggestions for solving it if you have the same problem that I have.. :frowning: )

cheers,
Lodewijk

Whenever I am writing code it will stop working randomly in the middle of me writing code. I have to keep using end task manager every five minutes. I never had this problem with the previous version of Rstudio.

UPDATE: today I discovered (my notebook fan started blowing) that rsession was eating up almost 200% CPU, while Rstudio NOT being stuck. I then also managed to do a Help--Diagnostics--request Log: this suggest that it could be during auto-save??
(I am going to try to turn that off.. even though that is more dangerous with Rstudio getting stuck regularly...)

cheers,
Lodewijk

same problem it just randomly freezes all the time

ok, turning auto-save off did not help either :expressionless:
when I find the time, I will file a bug at github

cheers,
/Lodewijk