Runtime error crashes R session on macOS Sonoma (arm64)
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
Summary:
Models that contain runtime errors crash my R session across many versions of rstan.
Description:
Any model that contains a runtime error is crashing my R session. Models compile fine. If no runtime errors occur models sample fine in most cases, although I am also experiencing somewhat random crashes. For example using cholesky_decompose will sometimes also produce a crash, this is less reproducible. I have tried the current CRAN versions (2.32.5), development versions
(2.33.1.9000), and have tried downgrading to rstan 2.21.8 with StanHeaders 2.26.28, all of them produce the same crash. My mac is an M1 on Sonoma 14.3.1, R version 4.3.2. An older intel mac on Ventura 13.6.4 has expected behaviour with no crashes. I can confirm that rstan was working normally as of late December, something must have changed since then.
Reproducible Steps:
This code reliably produces a crash on all of the versions mentioned above. Expected output is a runtime error due to the missing 'x' variable in the last line.
library(rstan)
set.seed(123)
stmod = "
data {
int <lower = 0> n;
vector [n] x;
}
parameters {
real mu;
real <lower = 0> sig;
}
model {
x ~ normal(mu, sig);
mu ~ normal(0, 10);
sig ~ cauchy(0, 5);
}
"
mod = stan_model(model_code = stmod)
samp_works = sampling(mod, data = list(n = 5, x = rnorm(5, 0, 1)), iter = 100, chains = 1)
# missing x in data list, should produce runtime error.
samp_crashes = sampling(mod, data = list(n = 5), iter = 100, chains = 1)
RStan Version:
Tried with 2.33.1.9000, 2.32.5, and 2.21.8.
R Version:
4.3.2
Operating System:
macOS 14.3.1.
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 running the reproducible sampling example through stan_model and sampling on macOS 14.3.1 with the reported RStan versions, then compare the missing-data case with the working case. Trace the runtime-error path for the missing x variable and the cholesky_decompose example. Done means the session remains stable and the missing-data call reports a runtime error instead of crashing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, r
- Domain
- backend, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100