Windows R session crashes when assigning multiple runs to same output
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
Summary:
Following on from this issue in the brms repo, the R session on Windows will crash when repeatedly assigning to the same output.
This is most easily replicated with brms. Using this list of brms arguments: test_brm.RData, the crash can be replicated via:
options(mc.cores=4)
library(brms)
load("test_brm.RData")
out = do.call(brm,test_brm)
out = do.call(brm,test_brm)
out = do.call(brm,test_brm)
#Crashes on this call:
out = do.call(brm,test_brm)
However, when I extract the Stan code, data and initial values from the brms object into
test_rstan.txt and do the same runs with 'pure' RStan, I don't get the same failures:
options(mc.cores=4)
library(rstan)
source("test_rstan.txt")
out = do.call(stan,test_rstan)
out = do.call(stan,test_rstan)
out = do.call(stan,test_rstan)
#Does not crash here
out = do.call(stan,test_rstan)
This leads me to believe the crash is related to the model compilation in some way, since the brms calls re-compile the model each time, but the rstan calls do not (even if I set rstan_options(auto_write = FALSE))
Contents of my Makevars & .Renviron files:
> readLines("~/.R/Makevars.win")
[1] "CXX14FLAGS += -O3"
> readLines("~/.Renviron")
[1] "PATH=\"${RTOOLS40_HOME}\\usr\\bin;${PATH}\""
Session Info:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.21.2 ggplot2_3.3.2 StanHeaders_2.21.0-6
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 pillar_1.4.6 compiler_4.0.2 prettyunits_1.1.1 tools_4.0.2
[6] pkgbuild_1.1.0 jsonlite_1.7.0 lifecycle_0.2.0 tibble_3.0.3 gtable_0.3.0
[11] pkgconfig_2.0.3 rlang_0.4.7 cli_2.0.2 rstudioapi_0.11 parallel_4.0.2
[16] curl_4.3 loo_2.3.1 gridExtra_2.3 withr_2.2.0 dplyr_1.0.2
[21] generics_0.0.2 vctrs_0.3.4 stats4_4.0.2 grid_4.0.2 tidyselect_1.1.0
[26] glue_1.4.2 inline_0.3.15 R6_2.4.1 processx_3.4.3 fansi_0.4.1
[31] callr_3.4.3 purrr_0.3.4 magrittr_1.5 codetools_0.2-16 matrixStats_0.56.0
[36] scales_1.1.1 ps_1.3.4 ellipsis_0.3.1 assertthat_0.2.1 colorspace_1.4-1
[41] V8_3.2.0 RcppParallel_5.0.2 munsell_0.5.0 crayon_1.3.4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Windows crash with the repeated do.call(brm, test_brm) calls and the linked test_brm.RData; compare this with the repeated do.call(stan, test_rstan) calls that do not crash. Investigate the model-compilation path implicated by the report and verify that repeated compilation no longer terminates the R session on Windows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100