Comments (4)
@ncullen93 the error suggests the you were running it on macOS in an interactive session - or that you included a package which tried to initialize interactive session/run-time. Please make sure the app is started via Rscript
on the command line and not in any GUI.
from restrserve.
Same segfault error when trying to create a DBI connection to a hosted database. It seems to work when the database is local, however.
Like adding using this to make a connection inside a handler causes a big segfault if it is not a local database:
conn <- DBI::dbConnect(RPostgres::Postgres(),
host ,
dbname,
user ,
password,
port )
Segfault looks like this:
*** caught segfault ***
address 0x110, cause 'memory not mapped'
Traceback:
1: connection_create(names(opts), as.vector(opts), check_interrupts)
2: .local(drv, ...)
3: DBI::dbConnect(RPostgres::Postgres(), ...)
4: DBI::dbConnect(RPostgres::Postgres(), ...)
5: FUN(request, response)
6: eval(quoted_code, env)
7: eval(quoted_code, env)
8: withCallingHandlers(eval(quoted_code, env), error = capture_calls)
9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
11: tryCatchList(expr, classes, parentenv, handlers)
12: tryCatch(withCallingHandlers(eval(quoted_code, env), error = capture_calls), error = identity)
13: try_capture_stack(expr)
14: private$eval_with_error_handling({ handler_id = private$match_handler(request, response) FUN = private$handlers[[handler_id]] self$logger$trace("", context = list(request_id = request$id, message = sprintf("call handler '%s'", handler_id))) FUN(request, response)})
15: eval(quoted_code, env)
16: eval(quoted_code, env)
17: withCallingHandlers(eval(quoted_code, env), error = capture_calls)
18: doTryCatch(return(expr), name, parentenv, handler)
19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
20: tryCatchList(expr, classes, parentenv, handlers)
21: tryCatch(withCallingHandlers(eval(quoted_code, env), error = capture_calls), error = identity)
22: try_capture_stack(expr)
23: private$eval_with_error_handling({ response$reset() response$set_content_type(self$content_type) self$logger$debug("", context = list(request_id = request$id, request = list(method = request$method, path = request$path, parameters_query = request$parameters_query, parameters_path = request$parameters_path, headers = request$headers))) mw_called = list() mw_flag = "process_request" need_call_handler = TRUE for (id in seq_along(private$middleware)) { mw_id = private$middleware[[id]][["id"]] self$logger$trace("", context = list(request_id = request$id, middleware = mw_id, message = sprintf("call %s middleware", mw_flag))) FUN = private$middleware[[id]][[mw_flag]] mw_status = private$eval_with_error_handling(FUN(request, response)) mw_called[[id]] = id if (!isTRUE(mw_status)) { need_call_handler = FALSE break } } if (isTRUE(need_call_handler)) { private$eval_with_error_handling({ handler_id = private$match_handler(request, response) FUN = private$handlers[[handler_id]] self$logger$trace("", context = list(request_id = request$id, message = sprintf("call handler '%s'", handler_id))) FUN(request, response) }) } mw_flag = "process_response" for (id in rev(mw_called)) { mw_id = private$middleware[[id]][["id"]] self$logger$trace("", context = list(request_id = request$id, middleware = mw_id, message = sprintf("call %s middleware", mw_flag))) FUN = private$middleware[[id]][[mw_flag]] mw_status = private$eval_with_error_handling(FUN(request, response)) } self$logger$debug("", context = list(request_id = request$id, response = list(status_code = response$status_code, headers = response$headers)))})
24: app$process_request()
25: self$convert_response(app$process_request())
26: .http.request("/fetchModels", NULL, NULL, as.raw(c(0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3a, 0x20, 0x47, 0x45, 0x54, 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x3a, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x3a, 0x38, 0x30, 0x38, 0x30, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x63, 0x75, 0x72, 0x6c, 0x2f, 0x37, 0x2e, 0x37, 0x37, 0x2e, 0x30, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x2a, 0x2f, 0x2a, 0x0a)))
27: doTryCatch(return(expr), name, parentenv, handler)
28: tryCatchOne(expr, names, parentenv, handlers[[1L]])
29: tryCatchList(expr, classes, parentenv, handlers)
30: 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, nlines = 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))})
31: try(.http.request("/fetchModels", NULL, NULL, as.raw(c(0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3a, 0x20, 0x47, 0x45, 0x54, 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x3a, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x3a, 0x38, 0x30, 0x38, 0x30, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x63, 0x75, 0x72, 0x6c, 0x2f, 0x37, 0x2e, 0x37, 0x37, 0x2e, 0x30, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x2a, 0x2f, 0x2a, 0x0a))), silent = TRUE)
32: (function (..., config.file = "/etc/Rserve.conf") { if (is.null(run_Rserve)) stop("Runnig inside an embedded Rserve instance - starting Rserve recursively is not supported") .Call(run_Rserve, as.character(config.file), sapply(list(...), as.character))})(http.port = 8080, port = 6311)
33: do.call(Rserve::run.Rserve, ARGS)
34: backend$start(app)
An irrecoverable exception occurred. R is aborting now ...
from restrserve.
from restrserve.
So weird... just deployed and it works perfectly find on heroku. Must be a local issue, but it's only with hosted databases. Sorry about that. I will close the issue and try to figure it out on my end.
from restrserve.
Related Issues (20)
- Question: content type zip / binary -> application/zip, application/octet-stream HOT 1
- Automated docker hub builds don't work anymore HOT 2
- Header Content is split on Comma HOT 7
- Example available with post request with json in, json out? HOT 2
- cannot use source or eval in Rserve.conf or in backend$start as additional args HOT 5
- [BUG] segfault when running umap in RestRserve endpoint HOT 4
- MacOS: "+[NSNumber initialize] may have been in progress in another thread when fork() was called." HOT 3
- serving static files HOT 5
- [BUG] slow to serve static file and swagger UI must use CDN
- [BUG] Rserve version wrong in description file
- Missing CORS response headers to some browsers' pre-flight checks? HOT 2
- Error when transfer is cancelled, leading to tempdir deletion HOT 7
- [BUG] "discarding buffer because too big" in ssl example HOT 2
- [BUG] to_json different form toJSON in jsonlite
- Sending emails hangs when using RestRserve instead of plumber HOT 3
- Not all errors are caught when processing requests HOT 2
- Background process doesn't kill correctly the childs HOT 1
- CI fails with segfault
- [QUESTION] Working with environment variables
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restrserve.