Search code examples
rrstudio

how do I troubleshoot fatal errors for simple commands: recursive gc invocation error after library()


I'm getting an error for "recursive gc invocation" just loading some packages. If I set my code to run further, this error continues to pop out throughout, and R studio experiences a fatal error and aborts. I do not know how to trouble shoot this to fix it.

I have already tried to restart the program, but get the same error in the same place. This happens even if I restart the program, close the project, and try again in a new / blank script. The error is shown below.

What are appropriate steps at this juncture? Should I uninstall /reinstall R? Is there a better way to try to pinpoint what is going wrong?

This is what I get in the console when I load these two libraries:

> library(descr)
> library(data.table)
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
data.table 1.14.2 using 4 threads (see ?getDTthreads).  Latest news: r-datatable.com

I included session info if that helps, but honestly I'm not really sure where to begin trouble shooting this.

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] beepr_1.3         nngeo_0.4.4       stringr_1.4.0     bit64_4.0.5       bit_4.0.4         sf_1.0-5          data.table_1.14.2 descr_1.1.5      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7         magrittr_2.0.1     units_0.7-2        xtable_1.8-4       R6_2.5.1           rlang_0.4.12       tools_4.1.2        grid_4.1.2        
 [9] audio_0.1-10       KernSmooth_2.23-20 e1071_1.7-9        DBI_1.1.2          ellipsis_0.3.2     class_7.3-19       lifecycle_1.0.1    vctrs_0.3.8       
[17] glue_1.6.0         stringi_1.7.6      proxy_0.4-26       compiler_4.1.2     generics_0.1.1     classInt_0.4-3    

Solution

  • To others who may find this problem, this is what I did. I don't know how it fixed it, but it's working;

    1. I ran into the problem, restarted R and retried: same problem
    2. I opened a new project / blank script, copied the code and tried the code again: same problem
    3. I tried it with slightly different code: same problem
    4. I restarted my computer and tried steps 1:3 again: same problem
    5. I uninstalled and resintalled R: solved.

    Is this a good way to solve this problem? No clue. Will this work for everyone? Also no idea. But it fixed it in my case. ¯_(ツ)/¯ ¯_(ツ)