I work on a virtual Windows server that I remote into. For the last few weeks many of my RStudio sessions have been crashing within a few minutes to a few hours. The crash almost always happens in the middle of some operation on a relatively large data frame (a few million rows), often a dplyr pipe of several operations or creating a ggplot, where the following is written to the console.
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
Then, usually within about 10 to 30 seconds, RStudio crashes. When I reopen the project, whatever code edits I hadn't saved are generally gone. Also, even after RStudio crashes, I can see in the Task Manager that R and RStudio processes related to the crashed session are still running, and any RAM the session was using is often still tied up and not available for other processes.
I've also been getting another type of warning I haven't seen before. This one doesn't seem to be associated with crashes, but I'm including an example in case it's relevant. This warning seems to occur in the middle of dplyr
pipe operations.:
Warning: stack imbalance in '.Call', 78 then 76
Warning: stack imbalance in '{', 74 then 72
Warning: stack imbalance in '.Call', 76 then 75
Warning: stack imbalance in '{', 72 then 71
I don't have a reproducible example, because this seems to happen randomly and doesn't seem to depend on the specific code I've been running. My local computer is a Macbook Pro and I've never had this happen on it. I'd also never seen the "recursive gc invocation" warning until a few weeks ago. I'm not sure if it coincided with any particular changes in the system or the R setup.
Below are the details for the remote virtual computer. Please let me know if additional information would be helpful. I'd appreciate any ideas you might have on what is causing the problem and how to stop it from happening.
Operating system: Windows Server 2016 Standard, Version 1607, Build 14393.4886
R version 4.1.2
RStudio version: 2021.09.2+382 "Ghost Orchid" Release (fc9e217980ee9320126e33cdf334d4f4e105dc4f, 2022-01-04) for Windows, Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36Session info varies, but below is a typical one. I also load several internal packages that I haven't included below.
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server x64 (build 14393)Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252attached base packages:
[1] tools stats graphics grDevices utils datasets methods baseother attached packages:
[1] ggdist_3.0.1 naniar_0.6.1 vroom_1.5.7
[4] patchwork_1.1.1 forcats_0.5.1 stringr_1.4.0
[7] dplyr_1.0.7 purrr_0.3.4 readr_2.1.1
[10] tidyr_1.1.4 tibble_3.1.6 ggplot2_3.3.5
[13] tidyverse_1.3.1 lubridate_1.8.0 readxl_1.3.1
[16] scales_1.1.1 fst_0.9.4 openxlsx_4.2.5
[19] rlang_0.4.12 knitr_1.37
[34] reprex_2.0.1 testthat_3.1.1 devtools_2.4.3
[37] usethis_2.1.5loaded via a namespace (and not attached):
[1] fs_1.5.2 bit64_4.0.5 httr_1.4.2 rprojroot_2.0.2 backports_1.4.1
[6] utf8_1.2.2 R6_2.5.1 DBI_1.1.2 colorspace_2.0-2 withr_2.4.3
[11] tidyselect_1.1.1 prettyunits_1.1.1 processx_3.5.2 bit_4.0.4 compiler_4.1.2
[16] cli_3.1.0 rvest_1.0.2 xml2_1.3.3 desc_1.4.0 odbc_1.3.3
[21] callr_3.7.0 digest_0.6.29 rmarkdown_2.11 pkgconfig_2.0.3 htmltools_0.5.2
[26] sessioninfo_1.2.2 dbplyr_2.1.1 fastmap_1.1.0 keyring_1.3.0 rstudioapi_0.13
[31] farver_2.1.0 generics_0.1.1 jsonlite_1.7.2 distributional_0.3.0 zip_2.2.0
[36] magrittr_2.0.1 Rcpp_1.0.7 munsell_0.5.0 fansi_0.5.0 visdat_0.5.3
[41] lifecycle_1.0.1 stringi_1.7.6 yaml_2.2.1 pkgbuild_1.3.1 blob_1.2.2
[46] grid_4.1.2 parallel_4.1.2 crayon_1.4.2 haven_2.4.3 hms_1.1.1
[51] ps_1.6.0 pillar_1.6.4 pkgload_1.2.4 glue_1.6.0 evaluate_0.14
[56] remotes_2.4.2 modelr_0.1.8 vctrs_0.3.8 tzdb_0.2.0 cellranger_1.1.0
[61] gtable_0.3.0 assertthat_0.2.1 cachem_1.0.6 xfun_0.29 broom_0.7.11
[66] memoise_2.0.1 ellipsis_0.3.2