Warning message:
In find.package(package, lib.loc, verbose = verbose) :
package ‘base’ found more than once, using the first from
“/Library/Frameworks/R.framework/Resources/library/base”,
“/Library/Frameworks/R.framework/Versions/4.0/Resources/library/base”
happens. Maybe something doesn’t know that something else was deleted?
I don’t know how calling some ggplot2 stuff on a matrix of draws that has already been extracted from the stanfit object would cause problems. Can you try
It looks like R automatically creates links pointing /R.framework/Resources/ to /R.framework/Versions/Current/Resources/ . Yesterday I removed R, XCode command line tools, reinstalled Catalina, installed XCode and R from scratch, and got to the same crash malloc errors. In any case, it seems that the crashes shouldn’t be related to this warning msg?
@bgoodri I think this did the trick! Thanks so much! After running 10 different models none of them returned the malloc messages before or after the model fit, and no crashes observed after that.
The warning message about finding two base paths with the verbose rstan example still exists, so I’m not sure what is going on there.
I updated to Catalina v10.15.6 yesterday and that seems to have fixed the problem (that isn’t why I updated, but seems to have worked anyways). Perhaps this problem has been some weird interaction between RStudio, R, and Catalina. Thanks for everyone’s help, though!
@wds Installing from github (which does not use tbbmalloc_proxy on any Mac) seems to have fixed the malloc error @dbarneche was having. Does that give us any clue as to why tbbmalloc_proxy was nondeterministically crashing R CMD check?
For me too, installing the development version of RStan from Github solved the problem (with javascript=F; the new compiler doesn’t work). Before that, I tried the newest binary and source versions from CRAN (2.21.1, and then 2.21.2 from source, probably).
Hi there, first post. I’m also encountering an issue like this. The model samples fine, but right when it gets to the end of sampling and is in the process of saving to an R object, boom, session aborted. It doesn’t happen every time, but it happens often enough to be incredibly frustrating, especially as the model I am working with takes several hours minimum to run (I know that is nothing compared to what some go through). It will also occasionally happen when sampling from the posterior using the rethinking function “link”. It’s hard to be certain, but it seems to happen more often when overwriting an existing R object.
Like our OP, I am using the rstan via the rethinking package. Newest versions of R, Rstudio, rstan and all associated packages as of this morning (with the exception of withr, which is 2.2.0), and I’m using Windows. I tried to install the development version of rstan as recommended in this thread, but that did not work and generated the following output:
Downloading GitHub repo stan-dev/rstan@develop
/usr/bin/tar: stan-dev-rstan-2f29681/StanHeaders/inst/include/libsundials: Cannot create symlink to ‘mathlib/lib/sundials_4.1.0/’: No such file or directory
/usr/bin/tar: stan-dev-rstan-2f29681/StanHeaders/inst/include/src: Cannot create symlink to ‘upstream/src/’: No such file or directory
/usr/bin/tar: stan-dev-rstan-2f29681/StanHeaders/inst/include/stan: Cannot create symlink to ‘mathlib/stan/’: No such file or directory
/usr/bin/tar: Exiting with failure status due to previous errors
External tar failed with --force-local, trying without
/usr/bin/tar: stan-dev-rstan-2f29681/StanHeaders/inst/include/libsundials: Cannot create symlink to ‘mathlib/lib/sundials_4.1.0/’: No such file or directory
/usr/bin/tar: stan-dev-rstan-2f29681/StanHeaders/inst/include/src: Cannot create symlink to ‘upstream/src/’: No such file or directory
/usr/bin/tar: stan-dev-rstan-2f29681/StanHeaders/inst/include/stan: Cannot create symlink to ‘mathlib/stan/’: No such file or directory
/usr/bin/tar: Exiting with failure status due to previous errors
“C:\PROGRA~1\Git\cmd\git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop GitHub - stan-dev/stan: Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details. C:\Users\KEVIN_~1\AppData\Local\Temp\RtmpSMtcsb\remotes1cdc4d4d802/stan-dev-rstan-2f29681/rstan/rstan/…/…/StanHeaders/inst/include/upstream
Error: Failed to install ‘rstan’ from GitHub:
Command failed (128)
In addition: Warning messages:
1: In utils::untar(tarfile, …) :
‘tar.exe -xf “C:\Users\KEVIN_~1\AppData\Local\Temp\RtmpSMtcsb\file1cdc496c6b5a.tar.gz” -C “C:/Users/KEVIN_~1/AppData/Local/Temp/RtmpSMtcsb/remotes1cdc4d4d802”’ returned error code 2
2: In system(full, intern = TRUE, ignore.stderr = quiet) :
running command ‘“C:\PROGRA~1\Git\cmd\git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop GitHub - stan-dev/stan: Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details. C:\Users\KEVIN_~1\AppData\Local\Temp\RtmpSMtcsb\remotes1cdc4d4d802/stan-dev-rstan-2f29681/rstan/rstan/…/…/StanHeaders/inst/include/upstream’ had status 128
Any advice here? Seems like others had luck fixing this problem with rstan development version, so would be nice if that did the trick for me too.
I have ended up using cmdstanr and converting to an rstan object for plotting etc., but even then R from RStudio sometimes crashes with the first plot after fitting. That is relatively rare and manageable by saving the fit object as an RDS file, just in case. This instability may be unrelated to crashes at the end of rstan model fitting.
I don’t have a case available for testing, but a contributing factor to crashes may be that there are both tidyr::extract and rstan::extract, and that at least I currently have in the global namespace the tidyr version.
I have a very similar problem. Running a fairly straightforward hierarchical model. Sampling goes fine, extracting the posterior goes fine, but it aborts on the plotting of the means.
Error message:
R(2872,0x1119c9dc0) malloc: Attempted to register zone more than once: 0x106387110
R(2872,0x1119c9dc0) malloc: Non-aligned pointer 0x10cb5b940 being freed (2)
R(2872,0x1119c9dc0) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6
Are there any updates on a fix? Happy to share reproducible example and system info. I have tried running from RStudio, from R within Terminal on my Mac and from RStudioServer on a HPC.