runApp() crashes R session on OS X Mavericks with R version 3.1.1

39 views
Skip to first unread message

Hunt Sparra

unread,
Aug 19, 2014, 3:30:25 PM8/19/14
to shinyap...@googlegroups.com
I am trying to use runApp() to run a Shiny app locally from RSudio but R crashes with the message: 

"R Session Aborted. 
R encountered a fatal error.
The session was terminated" 

runExample("01_hello") also results in the crash. R is version 3.1.1 and RStudio is version 0.98.1028. 

Hunt Sparra

unread,
Aug 19, 2014, 3:47:10 PM8/19/14
to shinyap...@googlegroups.com
I updated all my packages and the problem persists. I also tried removing and re-installing the "Rcpp", "httpuv", and the "shiny" packages but R still crashes.

Hunt Sparra

unread,
Aug 19, 2014, 4:11:00 PM8/19/14
to shinyap...@googlegroups.com
I have narrowed the problem down to a single line in a renderPlot() function in the server.R file:

ggplot(data2, aes_string(x=input$x, y=input$y)) + geom_point()

library(ggplot2) is called at the top of the file along with library(shiny). x and y are both from two selectInput() functions in the ui.R and have default values and their values are both columns in the data frame, data2. Running the code outside shiny works as expected. 


On Tuesday, August 19, 2014 3:30:25 PM UTC-4, Hunt Sparra wrote:

Fereshteh Karimeddini

unread,
Aug 19, 2014, 5:50:23 PM8/19/14
to shinyap...@googlegroups.com
Hunt,

Can you please provide output of sessionInfo() command?

We will look into this, but for future you might want to post Shiny-specific questions/issues to this forum:


You probably get more responses from the community of Shiny users on that forum.


Best,
Fereshteh

Hunt Sparra

unread,
Aug 20, 2014, 7:44:06 AM8/20/14
to shinyap...@googlegroups.com
Here is the output from sessionInfo() just before running the app with runApp().

R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_0.10.1

loaded via a namespace (and not attached):
[1] bitops_1.0-6    caTools_1.17    digest_0.6.4    htmltools_0.2.4 httpuv_1.3.0    Rcpp_0.11.2     RJSONIO_1.3-0   tools_3.1.1     xtable_1.7-3  

Thank you for the pointer to the other group.

Hunt Sparra

unread,
Aug 20, 2014, 9:01:47 AM8/20/14
to shinyap...@googlegroups.com
In case this helps you here is what is output when run from R.app:

Warning: Removed 4 rows containing missing values (geom_point).

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

Traceback:
 1: .Call("bitShiftR", a, b, PACKAGE = "bitops")
 2: bitShiftR(x[1, ], 2)
 3: base64encode(fileData)
 4: shinysession$fileUrl(name, outfile, contentType = "image/png")
 5: orig(name = name, shinysession = .self)
 6: func()
 7: withCallingHandlers(expr, error = function(e) {    handle <- getOption("shiny.error")    if (is.function(handle))         handle()})
 8: shinyCallingHandlers(func())
 9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
11: tryCatchList(expr, classes, parentenv, handlers)
12: tryCatch(shinyCallingHandlers(func()), shiny.silent.error = function(cond) {    structure(NULL, class = "try-error", condition = cond)})
13: doTryCatch(return(expr), name, parentenv, handler)
14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
15: tryCatchList(expr, classes, parentenv, handlers)
16: 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        msg <- conditionMessage(e)        sm <- strsplit(msg, "\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 && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = stderr())        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
17: try({    tryCatch(shinyCallingHandlers(func()), shiny.silent.error = function(cond) {        structure(NULL, class = "try-error", condition = cond)    })}, silent = FALSE)
18: func()
19: withCallingHandlers(expr, error = function(e) {    handle <- getOption("shiny.error")    if (is.function(handle))         handle()})
20: shinyCallingHandlers(func())
21: env$runWith(.self, func)
22: tryCatchList(expr, classes, parentenv, handlers)
23: tryCatch(env$runWith(.self, func), finally = .graphExitContext(id))
24: withReactiveDomain(.domain, {    env <- .getReactiveEnvironment()    .graphEnterContext(id)    tryCatch(env$runWith(.self, func), finally = .graphExitContext(id))})
25: ctx$run(.func)
26: run()
27: func()
28: withCallingHandlers({    func()}, warning = function(e) {}, error = function(e) {})
29: FUN(X[[1L]], ...)
30: lapply(.flushCallbacks, function(func) {    withCallingHandlers({        func()    }, warning = function(e) {    }, error = function(e) {    })})
31: ctx$executeFlushCallbacks()
32: .getReactiveEnvironment()$flush()
33: flushReact()
34: handler(binary, message)
35: doTryCatch(return(expr), name, parentenv, handler)
36: tryCatchOne(expr, names, parentenv, handlers[[1L]])
37: tryCatchList(expr, classes, parentenv, handlers)
38: 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        msg <- conditionMessage(e)        sm <- strsplit(msg, "\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 && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = stderr())        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
39: try(handler(binary, message))
40: (function (handle, binary, message) {    for (handler in .wsconns[[as.character(handle)]]$.messageCallbacks) {        result <- try(handler(binary, message))        if (inherits(result, "try-error")) {            .wsconns[[as.character(handle)]]$close()            return()        }    }})("106652629379264", FALSE, "{\"method\":\"init\",\"data\":{\"names\":false,\"recent\":false,\"y\":\"range\",\"x\":\"lbs\",\"color\":\"year\",\".clientdata_output_plot1_width\":1784,\".clientdata_output_plot1_height\":400,\".clientdata_output_plot1_hidden\":false,\".clientdata_pixelratio\":1,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"127.0.0.1\",\".clientdata_url_port\":\"4627\",\".clientdata_url_pathname\":\"/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_singletons\":\"\",\".clientdata_allowDataUriScheme\":true}}")
41: eval(substitute(expr), envir, enclos)
42: evalq((function (handle, binary, message) {    for (handler in .wsconns[[as.character(handle)]]$.messageCallbacks) {        result <- try(handler(binary, message))        if (inherits(result, "try-error")) {            .wsconns[[as.character(handle)]]$close()            return()        }    }})("106652629379264", FALSE, "{\"method\":\"init\",\"data\":{\"names\":false,\"recent\":false,\"y\":\"range\",\"x\":\"lbs\",\"color\":\"year\",\".clientdata_output_plot1_width\":1784,\".clientdata_output_plot1_height\":400,\".clientdata_output_plot1_hidden\":false,\".clientdata_pixelratio\":1,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"127.0.0.1\",\".clientdata_url_port\":\"4627\",\".clientdata_url_pathname\":\"/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_singletons\":\"\",\".clientdata_allowDataUriScheme\":true}}"),     <environment>)
43: doTryCatch(return(expr), name, parentenv, handler)
44: tryCatchOne(expr, names, parentenv, handlers[[1L]])
45: tryCatchList(expr, classes, parentenv, handlers)
46: tryCatch(evalq((function (handle, binary, message) {    for (handler in .wsconns[[as.character(handle)]]$.messageCallbacks) {        result <- try(handler(binary, message))        if (inherits(result, "try-error")) {            .wsconns[[as.character(handle)]]$close()            return()        }    }})("106652629379264", FALSE, "{\"method\":\"init\",\"data\":{\"names\":false,\"recent\":false,\"y\":\"range\",\"x\":\"lbs\",\"color\":\"year\",\".clientdata_output_plot1_width\":1784,\".clientdata_output_plot1_height\":400,\".clientdata_output_plot1_hidden\":false,\".clientdata_pixelratio\":1,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"127.0.0.1\",\".clientdata_url_port\":\"4627\",\".clientdata_url_pathname\":\"/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_singletons\":\"\",\".clientdata_allowDataUriScheme\":true}}"),     <environment>), error = .rcpp_error_recorder)
47: .Call("httpuv_run", PACKAGE = "httpuv", timeoutMillis)
48: run(timeoutMs)
49: service(timeout)
50: serviceApp()
51: withCallingHandlers(expr, error = function(e) {    handle <- getOption("shiny.error")    if (is.function(handle))         handle()})
52: shinyCallingHandlers(while (!.globals$stopped) {    serviceApp()    Sys.sleep(0.001)})
53: runApp()

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

I reinstalled the base64enc package and now RStudio does not crash, however, R.app stiller returns the same message.

On Tuesday, August 19, 2014 5:50:23 PM UTC-4, Fereshteh Karimeddini wrote:

Yihui Xie

unread,
Aug 20, 2014, 1:02:35 PM8/20/14
to Hunt Sparra, shinyap...@googlegroups.com
Interesting. The issue should be irrelevant to the base64enc package,
since shiny does not use it. Instead, caTools::base64encode() is used.
If you need to reinstall anything, you should reinstall bitops
package. Or just reinstall everything:

install.packages(rownames(installed.packages(priority = 'NA')))

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Web: http://yihui.name

Hunt Sparra

unread,
Aug 20, 2014, 4:26:18 PM8/20/14
to shinyap...@googlegroups.com, hspar...@gmail.com
Reinstalling all packages eliminated the issue.
Reply all
Reply to author
Forward
0 new messages