New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault in optimizing for simple exponential model #545

Closed
NathanWycoff opened this Issue Jul 9, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@NathanWycoff

NathanWycoff commented Jul 9, 2018

This issue ported over from here.

Hello everyone,

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:

  1. Please find the model attached exp_model.txt
  2. Please find an R script attached breaks_stan.txt. Rename these if necessary (not sure why github won't accept R/stan files).
  3. Modify line 36 of the R file to point to where exp_model.stan lives on disk.
  4. 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.

Bug Description:
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 (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

rstan (Version 2.17.3, GitRev: 2e1f913)

R was executed directly from a bash terminal.

@bob-carpenter

This comment has been minimized.

Contributor

bob-carpenter commented Jul 9, 2018

@maverickg

This comment has been minimized.

Contributor

maverickg commented Jul 9, 2018

Well, I tried on the last released version of CmdStan and had segfault for some particular seed too. So I don't think it's a RStan issue.

This is the seed I used:

./exp_model optimize data file=exp.rdump random seed=12345

And exp.rdump file has

$ more exp.rdump
alpha_l1_0 <- 0.2
alpha_l2_0 <- 0.2
beta_l1_0 <- 1
beta_l2_0 <- 1
t1 <- 0.281152420352801
t2 <- 0.164745791682175
@bob-carpenter

This comment has been minimized.

Contributor

bob-carpenter commented Jul 9, 2018

@bob-carpenter

This comment has been minimized.

Contributor

bob-carpenter commented Jul 9, 2018

This issue was moved to stan-dev/stan#2576

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment