R crashes with brms::update and brm(..., control = list(....))

When running update in brms, or when running models that include the command control = list(...) , R completely crashes. This happens in Rstudio and plain R. I am using the latest StanHeaders and Rstan I believe. I am on a MacBook Pro (13-inch, M1, 2020) running BigSur 11.6.

Any thoughts would be much appreciated!!

example from package:

## Works Fine
fit1 <- brm(time | cens(censored) ~ age * sex + disease + (1|patient), 
            data = kidney, family = gaussian("log"))

## Crashes R
fit2 <- update(fit1, formula. = ~ . - disease)

## Crashes R
fit3 <- brm(time | cens(censored) ~ age * sex + disease + (1|patient), 
            data = kidney, family = gaussian("log"), control = list(adapt.delta = 0.97))
> sessionInfo()

R version 4.1.1 (2021-08-10)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib

[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] brms_2.16.3 Rcpp_1.0.7 

loaded via a namespace (and not attached):
  [1] nlme_3.1-153         matrixStats_0.61.0   xts_0.12.1           threejs_0.3.3       
  [5] rstan_2.21.2         tensorA_0.36.2       tools_4.1.1          backports_1.4.0     
  [9] utf8_1.2.2           R6_2.5.1             DT_0.20              mgcv_1.8-38         
 [13] DBI_1.1.1            projpred_2.0.2       colorspace_2.0-2     withr_2.4.3         
 [17] tidyselect_1.1.1     gridExtra_2.3        prettyunits_1.1.1    processx_3.5.2      
 [21] Brobdingnag_1.2-6    emmeans_1.7.0        curl_4.3.2           compiler_4.1.1      
 [25] cli_3.1.0            shinyjs_2.0.0        colourpicker_1.1.1   posterior_1.1.0     
 [29] scales_1.1.1         dygraphs_1.1.1.6     checkmate_2.0.0      mvtnorm_1.1-3       
 [33] ggridges_0.5.3       callr_3.7.0          stringr_1.4.0        digest_0.6.29       
 [37] StanHeaders_2.21.0-7 minqa_1.2.4          base64enc_0.1-3      pkgconfig_2.0.3     
 [41] htmltools_0.5.2      lme4_1.1-27.1        fastmap_1.1.0        htmlwidgets_1.5.4   
 [45] rlang_0.4.12         shiny_1.7.1          farver_2.1.0         generics_0.1.1      
 [49] zoo_1.8-9            jsonlite_1.7.2       crosstalk_1.2.0      gtools_3.9.2        
 [53] dplyr_1.0.7          distributional_0.2.2 inline_0.3.19        magrittr_2.0.1      
 [57] loo_2.4.1            bayesplot_1.8.1      Matrix_1.3-4         munsell_0.5.0       
 [61] fansi_0.5.0          abind_1.4-5          lifecycle_1.0.1      stringi_1.7.6       
 [65] MASS_7.3-54          pkgbuild_1.2.1       plyr_1.8.6           grid_4.1.1          
 [69] parallel_4.1.1       promises_1.2.0.1     crayon_1.4.2         miniUI_0.1.1.1      
 [73] lattice_0.20-45      splines_4.1.1        ps_1.6.0             pillar_1.6.4        
 [77] igraph_1.2.9         boot_1.3-28          markdown_1.1         estimability_1.3    
 [81] shinystan_2.5.0      reshape2_1.4.4       codetools_0.2-18     stats4_4.1.1        
 [85] rstantools_2.1.1     glue_1.5.1           V8_3.6.0             RcppParallel_5.1.4  
 [89] nloptr_1.2.2.3       vctrs_0.3.8          httpuv_1.6.3         gtable_0.3.0        
 [93] purrr_0.3.4          assertthat_0.2.1     ggplot2_3.3.5        mime_0.12           
 [97] xtable_1.8-4         coda_0.19-4          later_1.3.0          rsconnect_0.8.25    
[101] tibble_3.1.6         shinythemes_1.2.0    gamm4_0.2-6          ellipsis_0.3.2      
[105] bridgesampling_1.1-2
1 Like

Update: Everything seems to be working ok folllowing a full uninstall and install of rstan, StanHeaders, and cmdstanr using the repo versions outlines in Martin’s reply here, and also setting options(brms.backend = "cmdstanr"). Without using cmdstanr R still crashes.

1 Like