stan-dev / stan-dev/rstan

segfault on very simple program

Open
#836 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

fit <- stan(file = 'schools.stan', data = schools_dat)
from the RStan tutorial results in failure

Description:

*** caught segfault ***
address 0x3c580e7ca670, cause 'memory not mapped'

Traceback:
1: context_eval(join(src), private$context, serialize)
2: get_str_output(context_eval(join(src), private$context, serialize))
3: evaluate_js(src, serialize = TRUE)
4: get_json_output(evaluate_js(src, serialize = TRUE))
5: ctx$call("stanc", model_name, paste(model_code, collapse = "\n"))
6: doTryCatch(return(expr), name, parentenv, handler)
7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
8: tryCatchList(expr, classes, parentenv, handlers)
9: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
10: try(ctx$call("stanc", model_name, paste(model_code, collapse = "\n")), silent = TRUE)
11: stanc_beta(model_code, model_name, isystem)
12: doTryCatch(return(expr), name, parentenv, handler)
13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
14: tryCatchList(expr, classes, parentenv, handlers)
15: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))})
16: try(stanc_beta(model_code, model_name, isystem))
17: stanc(file = file, model_code = model_code, model_name = model_name, verbose = verbose, obfuscate_model_name = obfuscate_model_name, allow_undefined = allow_undefined, isystem = isystem)
18: stan_model(file, model_name = model_name, model_code = model_code, stanc_ret = NULL, boost_lib = boost_lib, eigen_lib = eigen_lib, save_dso = save_dso, verbose = verbose)
19: stan(file = "schools.stan", data = schools_dat)

Reproducible Steps:

fit <- stan(file = 'schools.stan', data = schools_dat)
shools_dat and schools.stan initialised as instructed

Current Output:

Segfault

Expected Output:

as explained in tutorial

RStan Version:

The version of RStan you are running (e.g., from packageVersion("rstan"))
2.21.2

R Version:

The version of R you are running (e.g., from R.version.string)
R version 4.0.2 (2020-06-22)

Operating System:

CentOS-8 on a x86_64 machine
I took libnghttp2-devel-1.41 and nodejs-12.18.3 from Fedora32 and recompiled them using the rpm build system. This way everything is supposed to be coherent (same compiler, ...)

Any idea ?
Thanks
Pascal Dupuis

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the tutorial call stan(file = 'schools.stan', data = schools_dat) with RStan 2.21.2 on R 4.0.2 and CentOS 8. Trace the failure through stanc_beta, context_eval, and evaluate_js, using the reported stack and environment details. Done means the schools example completes without a segmentation fault and produces the tutorial's expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.