I want to first thank the developers for an awesome software package that has helped me extensively in several projects.
This bug doesn’t really affect me, but I felt like I should report it anyways. With a specific model/data combination and a specific random seed, I observe a segfault when invoking the optimizing function. The model is rather simple.
Steps to reproduce:
- Please find the model attached (exp_model.stan) exp_model.stan (558 Bytes)
- Please find an R script attached (breaks_stan.R) breaks_stan.R (917 Bytes)
- Modify line 36 of the R file to point to where exp_model.stan lives on disk.
- Run the R file in its entirety. This is important to advance PRNG to the point of failure. This involves sampling from the posterior, but it terminates in less than half a second on my machine.
Posterior sampling from the model works fine. Afterwards, when trying to find the optimum, it will print the initial loglikelihood, then R will freeze for about half a minute before this message appears (the shrug emoji is just my replacement for the standard prompt):
¯\_(ツ)_/¯ optimizing(mod, data = stan_dat) Initial log joint probability = -8.18984 *** caught segfault *** address 0x256b38fff, cause 'memory not mapped' Traceback: 1: .External(list(name = "CppMethod__invoke_notvoid", address = <pointer: 0x7fdbf945fd70>, dll = list(name = "Rcpp", path = "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/libs/Rcpp.so", dynamicLookup = TRUE, handle = <pointer: 0x7fdbf9708d90>, info = <pointer: 0x7fdbf986aa20>), numParameters = -1L), <pointer: 0x7fdbf97fb9b0>, <pointer: 0x7fdbf9739640>, .pointer, ...) 2: sampler$call_sampler(c(args, dotlist)) 3: .local(object, ...) 4: optimizing(mod, data = stan_dat) 5: optimizing(mod, data = stan_dat) Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace
This only seems to occur for a specific PRNG state.
Facts about the platform this was discovered on:
OS: Mac OS High Sierra 10.13.2
R: R version 3.4.3 (2017-11-30) – “Kite-Eating Tree”
Copyright © 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
rstan (Version 2.17.3, GitRev: 2e1f913d3ca3)
R was executed directly from a bash terminal.