C Stack usage problem in RStudio with package 'Runuran'

Hi all,

I am running into C stack usage problems when using the R package Runuran in RStudio. The following MWE is taken from ?pinv.new:

require(Runuran)
## Create a sample of size 100 for N(0,1)
pdf <- function (x) { exp(-0.5*x^2) }
gen <- pinv.new(pdf = pdf, lb = -Inf, ub = Inf)
Error: C stack usage  7969212 is too close to the limit

The C Stack information is

> Cstack_info()
      size    current  direction eval_depth 
   7969177      12880          1          2 

The interesting thing is: The same code works perfectly fine in R via terminal or via the R GUI, just not in RStudio.

I have uninstalled and re-installed both R and RStudio, the problem continued to exist. My current specifics: R version 4.0.2 (2020-06-22), RStudio version 1.3.1093, macOS Catalina (10.15.6).

I appreciate any advice!

ADDED: When I am using RMarkdown in RStudio with the exact same code, the error does not occur! Now I am completely clueless.

1 Like

See this post. Not clear to me how running through RStudio affects this

thanks, the linked answer did not help resolve my issue (my 'ulimit' is unlimited). It is also not clear to me why this issue is only present via running in RStudio (btw, it's not only on my computer, my colleagues can reproduce above error message), and not in R via GUI or console.

1 Like

UPDATE: Track the issue on github

I get the identical result. I'll open a github issue:

No problem in terminal, whether root or not. No problem with the code block in an RMarkdown chunk. Fail in executing the block from CTRL-ENTER in an R script, with the Console pane, but not in the Terminal pane.

RStudio 1.3.1093 # LATEST as of 2020-10-14

sessionInfo()
#> R version 4.0.2 (2020-06-22)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Pop!_OS 20.04 LTS ## Ubuntu with hot pants
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
#> 
#> 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=en_US.UTF-8       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     
#> 
#> loaded via a namespace (and not attached):
#>  [1] crayon_1.3.4      digest_0.6.25     backports_1.1.10  lifecycle_0.2.0  
#>  [5] reprex_0.3.0.9001 magrittr_1.5      evaluate_0.14     pillar_1.4.6     
#>  [9] highr_0.8         stringi_1.5.3     rlang_0.4.8       rstudioapi_0.11  
#> [13] fs_1.5.0          vctrs_0.3.4       ellipsis_0.3.1    rmarkdown_2.4    
#> [17] styler_1.3.2      tools_4.0.2       stringr_1.4.0     purrr_0.3.4      
#> [21] xfun_0.18         yaml_2.2.1        compiler_4.0.2    pkgconfig_2.0.3  
#> [25] htmltools_0.5.0   knitr_1.30        tibble_3.0.4

Created on 2020-10-14 by the reprex package (v0.3.0.9001)

1 Like

Thank you, technocrat, for putting the issue on GitHub! For users looking for a workaround: It was suggested that a "workaround could be to turn off auto refresh on the environment pane". I can confirm that this resolved the issue in my case! :slight_smile:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.