R Shiny服务器分段错误

问题描述 投票:5回答:1

我在Linux机器上运行的Shiny Server上遇到以下分段错误:

-bash: line 1: 29254 Segmentation fault      R --no-save --slave -f \/opt\/shiny-server\/R\/SockJSAdapter\.R
"

它是在三天前开始的一个应用程序,以前工作正常。该应用程序不会在我的Windows计算机上出错。我已经更新了机器上的所有软件包和RStudio。我试图找到答案,但关于Segfaults的信息很少。

我试图重现错误并将代码剥离到最低限度。我发现渲染文本和表格(base和DataTables)没问题,但渲染任何绘图(base,ggplot,plotly)会产生分割错误。下面是从JavaScript控制台提供错误和错误消息的代码。

我也尝试通过Linux机器上的RStudio的Web浏览器启动代码,看看我是否可以获得更多信息,但它只是给我提供以下错误消息:Rstudio browser error message

> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0 

长子。 [R

library(shinydashboard)

dashboardPage(

  dashboardHeader(),


  dashboardSidebar(),


  dashboardBody(
    h4('Text'),
    textOutput('TextT'),
    dataTableOutput('Tabel'),
    plotOutput('Plot')

  )

)

server.R

server <- function(input, output, session) { 

  output$TextT = renderText('text text')

  output$Tabel = renderDataTable(data.frame(A = 1))

  output$Plot = renderPlot(plot(data.frame(x = c(1:10), y = c(11:20))))

}

JavaScript错误控制台:

68: messageHandler(binary, msg)
69: withCallingHandlers(expr, error = function(e) {    if (is.null(attr(e, "stack.trace", exact = TRUE))) {        calls <- sys.calls()        attr(e, "stack.trace") <- calls        stop(e)    }})
70: captureStackTraces(expr)
71: withCallingHandlers(captureStackTraces(expr), error = function(cond) {    if (inherits(cond, "shiny.silent.error"))         return()    if (isTRUE(getOption("show.error.messages"))) {        printError(cond, full = full, offset = offset)    }})
72: withLogErrors(messageHandler(binary, msg))
73: handler(binary, message)
74: doTryCatch(return(expr), name, parentenv, handler)
75: tryCatchOne(expr, names, parentenv, handlers[[1L]])
76: tryCatchList(expr, classes, parentenv, handlers)
77: 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 = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
78: try(handler(binary, message))
79: (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()        }    }})("60893360", FALSE, "{\"method\":\"init\",\"data\":{\"sidebarItemExpanded\":null,\"sidebarCollapsed\":false,\".clientdata_output_Plot_width\":1190,\".clientdata_output_Plot_height\":400,\".clientdata_output_TextT_hidden\":false,\".clientdata_output_Tabel_hidden\":false,\".clientdata_output_Plot_hidden\":false,\".clientdata_pixelratio\":0.8695651888847351,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"apps.teed.ee\",\".clientdata_url_port\":\"\",\".clientdata_url_pathname\":\"/VisualiseerimineVer2/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"\",\".clientdata_allowDataUriScheme\":true}}")
80: 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()        }    }})("60893360", FALSE, "{\"method\":\"init\",\"data\":{\"sidebarItemExpanded\":null,\"sidebarCollapsed\":false,\".clientdata_output_Plot_width\":1190,\".clientdata_output_Plot_height\":400,\".clientdata_output_TextT_hidden\":false,\".clientdata_output_Tabel_hidden\":false,\".clientdata_output_Plot_hidden\":false,\".clientdata_pixelratio\":0.8695651888847351,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"apps.teed.ee\",\".clientdata_url_port\":\"\",\".clientdata_url_pathname\":\"/VisualiseerimineVer2/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"\",\".clientdata_allowDataUriScheme\":true}}"),     <environment>)
81: 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()        }    }})("60893360", FALSE, "{\"method\":\"init\",\"data\":{\"sidebarItemExpanded\":null,\"sidebarCollapsed\":false,\".clientdata_output_Plot_width\":1190,\".clientdata_output_Plot_height\":400,\".clientdata_output_TextT_hidden\":false,\".clientdata_output_Tabel_hidden\":false,\".clientdata_output_Plot_hidden\":false,\".clientdata_pixelratio\":0.8695651888847351,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"apps.teed.ee\",\".clientdata_url_port\":\"\",\".clientdata_url_pathname\":\"/VisualiseerimineVer2/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"\",\".clientdata_allowDataUriScheme\":true}}"),     <environment>)
82: doTryCatch(return(expr), name, parentenv, handler)
83: tryCatchOne(expr, names, parentenv, handlers[[1L]])
84: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
85: doTryCatch(return(expr), name, parentenv, handler)
86: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
87: tryCatchList(expr, classes, parentenv, handlers)
88: 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()        }    }})("60893360", FALSE, "{\"method\":\"init\",\"data\":{\"sidebarItemExpanded\":null,\"sidebarCollapsed\":false,\".clientdata_output_Plot_width\":1190,\".clientdata_output_Plot_height\":400,\".clientdata_output_TextT_hidden\":false,\".clientdata_output_Tabel_hidden\":false,\".clientdata_output_Plot_hidden\":false,\".clientdata_pixelratio\":0.8695651888847351,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"apps.teed.ee\",\".clientdata_url_port\":\"\",\".clientdata_url_pathname\":\"/VisualiseerimineVer2/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"\",\".clientdata_allowDataUriScheme\":true}}"),     <environment>), error = function (x) x, interrupt = function (x) x)
89: .Call("httpuv_run", PACKAGE = "httpuv", timeoutMillis)
90: run(timeoutMs)
91: service(timeout)
92: serviceApp()
93: withCallingHandlers(expr, error = function(e) {    if (is.null(attr(e, "stack.trace", exact = TRUE))) {        calls <- sys.calls()        attr(e, "stack.trace") <- calls        stop(e)    }})
94: captureStackTraces({    scheduleFlush()    while (!.globals$stopped) {        serviceApp()        Sys.sleep(0.001)    }})
95: ..stacktraceoff..(captureStackTraces({    scheduleFlush()    while (!.globals$stopped) {        serviceApp()        Sys.sleep(0.001)    }}))
96: runApp(Sys.getenv("SHINY_APP"), port = port, launch.browser = FALSE)
An irrecoverable exception occurred. R is aborting now ...
-bash: line 1:  3049 Segmentation fault      R --no-save --slave -f \/opt\/shiny-server\/R\/SockJSAdapter\.

你知道它背后可能是什么或如何解决它?

先感谢您。

PS:我正在使用Shiny Dashboard,但是当我将它作为常规的Shiny应用程序运行时,我得到相同的消息

r plot graphics segmentation-fault shiny-server
1个回答
-2
投票

我遇到了完全相同的问题(闪亮的仪表板+ rhandsontable + ggplot2)。

Bárbara Borges suggested in a comment,在options(java.parameters = "-Xss2560k")and添加ui.R解决了我的问题。

© www.soinside.com 2019 - 2024. All rights reserved.