R Session Aborted

@Lucius No. I just simply changed to other computers/servers which work well.
I did not try out bgoodri’s advice, you might try:

If you call tempdir() before calling stan or sampling , there might be something in one of the .txt files in that directory that has more information about the error.

1 Like

I also have the same or similar problem. I am using Win 10 and R ver 3.6. On my Laptop with same OS, R and rstan versions everything works fine, but on my PC I am also getting “R Session Aborted” when calling the sampling method.

When I’m just using a single core, the error occurs right after a few iterations, to be precise: after the fourth iteration and I have to restart the session.

Calling the method in parallel with 4 cores I just get the error

Error in unserialize(socklist[[n]]) : error reading from connection
Error in serialize(data, node$con, xdr = FALSE) :
error writing to connection

after a few iterations, but don’t have to do a session restart.
The second, third, etc. call in parallel leads to the same error above, but not before the warmup iterations end up. And it is independet of the number of iterations.

After restarting the session, calling the sampling method crashes again immediately.

Does your model involve ODEs?

No

If it crashes after warmup and you are specifying save_warmup = FALSE, then I would suspect some sort of issue with the generated quantities block.

Hi,

I had this issue and downgrading from rstan 2.21 to 2.19.3 helped to reduce its frequency by ~95%.

Recently this problem was back (happens 1 per 30 rstan initializations, I run it in the loop) but I was able to found one use case when it happens every time: when immediately after calling stan() I switch from using monitor to using laptop monitor (I plug out the…plug). In that case laptop changes RStudio resolution and the crash happens at this precise moment. Still, from time to time it happens in other situations, not connected with resolution change. 3 cores, 2 chains, small dataset, ~ 20 parameters, Win10, Rstudio 1.4.1717, Rstan 2.19.3

Best,

Marek

I still cannot find a solution to this. Is there a thread somewhere?

Same here. When I run the following code Rstudio crashes (“fatal error”)

example(stan_model, package = "rstan", run.dontrun = TRUE)

It seems that I got that line from the following initially:

dotR ← file.path(Sys.getenv(“HOME”), “.R”)
if (!file.exists(dotR)) dir.create(dotR)
M ← file.path(dotR, “Makevars”)
if (!file.exists(M)) file.create(M)
cat(“\nCXX14FLAGS += -O3 -mtune=native -arch x86_64 -ftemplate-depth-256”,
file = M, sep = “\n”, append = FALSE).

R version 4.3.0 (2023-04-21)
Platform: aarch64-apple-darwin20 (64-bit)