Disconnection (Reload) issue

Hello,
I have an disconnect/reload issue about Shiny server.

Background: my application is designed to show/manipulate/query tables (I used DataTable) downloaded from a DB; the tables are quite big since there could be a lot of data in the DB.

Basically, I have these two situations:

  1. locally the web-app works without problems;
  2. on the server the same app contiues to disconnect showing the "Reload" message and it is impossible to work.

I tried to use different web browser and to change some settings in the configuration file of shiny-server but the problem still continues.
The IDE (RStudio) does not show any error; the only one that I receive is the "WebSocket" error which appears in the browser console.
I do not have anymore ideas since the issue comes up quite randomly so it is difficult to isolate the reason.

The only point which I do not deepen to much is the server-data infrastructure where the shiny server is installed.

Could the infrastructure affect the operation of my application?
Is there any configuration that I missed?

Thanks for any suggestion.

hi @sitritini, did you see any errors in the log files?

The infrastructure can definitely affect your application. Since you are mentioning that the tables used can be quite big, it could be a memory issue.

Hi,
thank you for the answer.
Below, there is the log of my server but it is not so helpful. It seems correct; the only strange row is the last one but I think that it is related to the closing of the brower.

Loading required package: DBI

Attaching package: ‘DT’

The following objects are masked from ‘package:shiny’:

    dataTableOutput, renderDataTable


Attaching package: ‘shinyjs’

The following object is masked from ‘package:RPostgreSQL’:

    show

The following object is masked from ‘package:DBI’:

    show

The following object is masked from ‘package:shiny’:

    runExample

The following objects are masked from ‘package:methods’:

    removeClass, show

Loading required package: RANN
Loading required package: NISTunits
Loading required package: pracma

Attaching package: ‘pracma’

The following object is masked from ‘package:purrr’:

    cross


Listening on http://127.0.0.1:37809

Execution halted

In the meanwhile, I am trying to check memory settings in order to understand if the problem is there o elsewhere.

After running your app once, can you provide the output of sessioninfo::session_info()? There were some issues in httpuv (the web-serving package that Shiny uses) related to WebSockets that were fixed recently. Installing the latest version of httpuv (1.4.4.1) from CRAN may help.

If you could also open up the JavaScript console in your web browser and see if there are any errors there, that would help.

I am having the same problem. There are no issues in my log file (see below):

[2018-05-18T08:58:05.190] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
[2018-05-18T09:13:05.894] [INFO] shiny-server - Stopping listener on 0.0.0.0:3838
[2018-05-18T09:13:05.895] [INFO] shiny-server - Shutting down worker processes (with notification)
[2018-05-18T09:13:30.123] [INFO] shiny-server - Shiny Server v1.5.7.907 (Node.js v8.10.0)
[2018-05-18T09:13:30.125] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2018-05-18T09:13:30.198] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be
running more securely as non-root.
[2018-05-18T09:13:30.202] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
[2018-05-18T09:18:35.368] [INFO] shiny-server - Stopping listener on 0.0.0.0:3838
[2018-05-18T09:18:35.370] [INFO] shiny-server - Shutting down worker processes (with notification)
[2018-05-18T09:20:56.831] [INFO] shiny-server - Shiny Server v1.5.7.907 (Node.js v8.10.0)
[2018-05-18T09:20:56.833] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2018-05-18T09:20:56.872] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be
running more securely as non-root.
[2018-05-18T09:20:56.874] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
[2018-05-18T09:26:35.568] [INFO] shiny-server - Stopping listener on 0.0.0.0:3838
[2018-05-18T09:26:35.569] [INFO] shiny-server - Shutting down worker processes (with notification)

I tried the suggestion from @winston for installing the latest version of httpuv but that did not solve my problem.

I have been trying to fix this problem for days now - have also gone through the manual. I really need some help.

Thank you very much!

Sara

In case it helps, below is the javascript console logs for our shiny-server webpage:

  1. HTML1300: Navigation occurred.

  2. CSS3121: The media query -ms-viewport has been deprecated.

  3. Thu Sep 20 2018 12:23:15 GMT-0400 (Eastern Daylight Time) [INF]: Connection opened.

  4. Thu Sep 20 2018 12:23:15 GMT-0400 (Eastern Daylight Time) [DBG]: Open channel 0

  5. Thu Sep 20 2018 12:23:15 GMT-0400 (Eastern Daylight Time) [INF]: Connection opened.

  6. Thu Sep 20 2018 12:23:15 GMT-0400 (Eastern Daylight Time) [DBG]: Open channel 0

  7. The application unexpectedly exited. Diagnostic information is private. Please ask your system admin for permission if you need to check the R logs.

  8. Thu Sep 20 2018 12:23:15 GMT-0400 (Eastern Daylight Time) [INF]: Connection closed. Info: {"type":"close","code":4503,"reason":"The application unexpectedly exited","wasClean":true}

  9. Thu Sep 20 2018 12:23:15 GMT-0400 (Eastern Daylight Time) [DBG]: SockJS connection closed

  10. Thu Sep 20 2018 12:23:15 GMT-0400 (Eastern Daylight Time) [DBG]: Channel 0 is closed

  11. Thu Sep 20 2018 12:23:15 GMT-0400 (Eastern Daylight Time) [DBG]: Removed channel 0, 0 left

  12. 6

SCRIPT7016: SCRIPT7016: Use of XMLHttpRequest with the synchronous flag set to true is deprecated due to its impact on user-perceived site performance.

  1. CSS3121: The media query -ms-viewport has been deprecated.

  2. Thu Sep 20 2018 12:23:17 GMT-0400 (Eastern Daylight Time) [DBG]: 2 message(s) discarded from buffer

  3. CSS3121: The media query -ms-viewport has been deprecated.

  4. Thu Sep 20 2018 12:23:17 GMT-0400 (Eastern Daylight Time) [DBG]: Open channel 1

  5. Thu Sep 20 2018 12:23:17 GMT-0400 (Eastern Daylight Time) [INF]: Connection closed. Info: {"type":"close","code":4503,"reason":"The application unexpectedly exited","wasClean":true}

  6. Thu Sep 20 2018 12:23:17 GMT-0400 (Eastern Daylight Time) [DBG]: SockJS connection closed

  7. Thu Sep 20 2018 12:23:17 GMT-0400 (Eastern Daylight Time) [DBG]: Channel 0 is closed

  8. Thu Sep 20 2018 12:23:17 GMT-0400 (Eastern Daylight Time) [DBG]: Channel 1 is closed

  9. Thu Sep 20 2018 12:23:17 GMT-0400 (Eastern Daylight Time) [DBG]: Removed channel 0, 1 left

  10. Thu Sep 20 2018 12:23:17 GMT-0400 (Eastern Daylight Time) [DBG]: Removed channel 1, 0 left

Hi, the problem here is within the R process, likely the Shiny app is throwing an R error. You can see the log for it under the /var/log/shiny-server/ directory on the server. If you don't see the relevant file there, then add the line preserve_logs true; to the top of /etc/shiny-server/shiny-server.conf, reload the server, and trigger the problem again. Then you should definitely have a log file available.

1 Like

Hi @jcheng,

Thank you for your time and help with this. I am getting the log files and checked the location you suggested. I am getting a segmentation fault. I have added my log file below... I am not sure what is causing this issue? I updated all my packages, including rmarkdown, prior to installing shiny.

sdunaj@eblackburn /var/log/shiny-server $ sudo more rmd-shiny-20180921-082315-37673.log

Listening on http://127.0.0.1:37673
^L


processing file: index.Rmd
output file: /tmp/RtmpFo2t0A/index.knit.md


Output created: /tmp/RtmpFo2t0A/file1d5e441e4408.html

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

Traceback:
 1: .External("cairo_create_new_device", as.character(ctype), file,     width, height, pointsize, bg, canvas, umpl, dpi, ..., PACKAGE = "Cairo")
 2: Cairo(width, height, type = "png", file = filename, pointsize = pointsize,     bg = bg, res = res, ...)
 3: pngfun(filename = filename, width = width, height = height, res = res,     ...)
 4: startPNG(outfile, width * pixelratio, height * pixelratio, res = res *     pixelratio, ...)
 5: drawPlot(name = "phonePlot", session = <environment>, func = function (...) {    if (..stacktraceon)         ..stacktraceon..(renderPlot(...))    else renderPlot(...)}, width = 196L, height = 2
70L, pixelratio = 1L, res = 72)
 6: do.call("drawPlot", c(list(name = outputName, session = session,     func = func, width = dims$width, height = dims$height, pixelratio = pixelratio,     res = res), args))
 7: force(expr)
 8: withVisible(force(expr))
 9: withCallingHandlers(expr, error = doCaptureStack)
10: globals$domain$wrapSync(expr)
11: promises::with_promise_domain(createStackTracePromiseDomain(),     expr)
12: captureStackTraces({    result <- withVisible(force(expr))    if (promises::is.promising(result$value)) {        p <- promise_chain(setVisible(result), ..., catch = catch,             finally =
 finally)        runFinally <- FALSE        p    }    else {        result <- Reduce(function(v, func) {            if (".visible" %in% names(formals(func))) {                withVisible(func(v$val
ue, .visible = v$visible))            }            else {                withVisible(func(v$value))            }        }, list(...), result)        setVisible(result)    }})
13: doTryCatch(return(expr), name, parentenv, handler)
14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
15: tryCatchList(expr, classes, parentenv, handlers)
16: tryCatch({    captureStackTraces({        result <- withVisible(force(expr))        if (promises::is.promising(result$value)) {            p <- promise_chain(setVisible(result), ..., catch = ca
tch,                 finally = finally)            runFinally <- FALSE            p        }        else {            result <- Reduce(function(v, func) {                if (".visible" %in% names(f
ormals(func))) {                  withVisible(func(v$value, .visible = v$visible))                }                else {                  withVisible(func(v$value))                }            },
list(...), result)            setVisible(result)        }    })}, error = function(e) {    if (!is.null(catch))         catch(e)    else stop(e)}, finally = if (runFinally && !is.null(finally)) fin
ally())
17: do()
18: hybrid_chain({    dims <- if (execOnResize)         getDims()    else isolate(getDims())    pixelratio <- session$clientData$pixelratio %OR% 1    do.call("drawPlot", c(list(name = outputName, s
ession = session,         func = func, width = dims$width, height = dims$height,         pixelratio = pixelratio, res = res), args))}, catch = function(reason) {    getDims()    stop(reason)})
19: `<reactive:plotObj>`(...)
20: ..stacktraceon..(`<reactive:plotObj>`(...))
21: .func()
22: withVisible(.func())
23: withCallingHandlers({    .error <<- FALSE    withVisible(.func())}, error = function(cond) {    .value <<- cond    .error <<- TRUE    .visible <<- FALSE})
24: contextFunc()
25: env$runWith(self, func)
26: force(expr)
27: globals$domain$wrapSync(expr)
28: promises::with_promise_domain(createVarPromiseDomain(.globals,     "domain", domain), expr)
29: withReactiveDomain(.domain, {    env <- .getReactiveEnvironment()    .graphEnterContext(id)    on.exit(.graphExitContext(id), add = TRUE)    env$runWith(self, func)})
30: globals$domain$wrapSync(expr)
31: promises::with_promise_domain(reactivePromiseDomain(), {    withReactiveDomain(.domain, {        env <- .getReactiveEnvironment()        .graphEnterContext(id)        on.exit(.graphExitContext(
id), add = TRUE)        env$runWith(self, func)    })})
32: ctx$run(function() {    result <- withCallingHandlers({        .error <<- FALSE        withVisible(.func())    }, error = function(cond) {        .value <<- cond        .error <<- TRUE        .
visible <<- FALSE    })    .value <<- result$value    .visible <<- result$visible})
33: self$.updateValue()
34: ..stacktraceoff..(self$.updateValue())
35: drawReactive()
36: force(expr)
37: withVisible(force(expr))
38: withCallingHandlers(expr, error = doCaptureStack)
39: globals$domain$wrapSync(expr)
40: promises::with_promise_domain(createStackTracePromiseDomain(),     expr)
41: captureStackTraces({    result <- withVisible(force(expr))    if (promises::is.promising(result$value)) {        p <- promise_chain(setVisible(result), ..., catch = catch,             finally =
 finally)        runFinally <- FALSE        p    }    else {        result <- Reduce(function(v, func) {            if (".visible" %in% names(formals(func))) {                withVisible(func(v$val
ue, .visible = v$visible))            }            else {                withVisible(func(v$value))            }        }, list(...), result)        setVisible(result)    }})
42: doTryCatch(return(expr), name, parentenv, handler)
43: tryCatchOne(expr, names, parentenv, handlers[[1L]])
44: tryCatchList(expr, classes, parentenv, handlers)
45: tryCatch({    captureStackTraces({        result <- withVisible(force(expr))        if (promises::is.promising(result$value)) {            p <- promise_chain(setVisible(result), ..., catch = ca
tch,                 finally = finally)            runFinally <- FALSE            p        }        else {            result <- Reduce(function(v, func) {                if (".visible" %in% names(f
ormals(func))) {                  withVisible(func(v$value, .visible = v$visible))                }                else {                  withVisible(func(v$value))                }            },
list(...), result)            setVisible(result)        }    })}, error = function(e) {    if (!is.null(catch))         catch(e)    else stop(e)}, finally = if (runFinally && !is.null(finally)) fin
ally())
46: do()
47: hybrid_chain(drawReactive(), function(result) {    dims <- getDims()    pixelratio <- session$clientData$pixelratio %OR% 1    do.call("resizeSavedPlot", c(list(name, shinysession, result,
   dims$width, dims$height, pixelratio, res), args))})
48: origRenderFunc(...)
49: `output$phonePlot`(...)
50: ..stacktraceon..(`output$phonePlot`(...))
51: orig(name = name, shinysession = self)
52: func()
53: withCallingHandlers(expr, error = doCaptureStack)
54: globals$domain$wrapSync(expr)
55: promises::with_promise_domain(createStackTracePromiseDomain(),     expr)
56: captureStackTraces(expr)
57: withCallingHandlers(captureStackTraces(expr), error = function(e) {    if (inherits(e, "shiny.silent.error"))         return()    handle <- getOption("shiny.error")    if (is.function(handle))
        handle()})
58: shinyCallingHandlers(func())
59: force(expr)
60: withVisible(force(expr))
61: withCallingHandlers(expr, error = doCaptureStack)
62: globals$domain$wrapSync(expr)
63: promises::with_promise_domain(createStackTracePromiseDomain(),     expr)
64: captureStackTraces({    result <- withVisible(force(expr))    if (promises::is.promising(result$value)) {        p <- promise_chain(setVisible(result), ..., catch = catch,             finally =
 finally)        runFinally <- FALSE        p    }    else {        result <- Reduce(function(v, func) {            if (".visible" %in% names(formals(func))) {                withVisible(func(v$val
ue, .visible = v$visible))            }            else {                withVisible(func(v$value))            }        }, list(...), result)        setVisible(result)    }})
65: doTryCatch(return(expr), name, parentenv, handler)
66: tryCatchOne(expr, names, parentenv, handlers[[1L]])
67: tryCatchList(expr, classes, parentenv, handlers)
68: tryCatch({    captureStackTraces({        result <- withVisible(force(expr))        if (promises::is.promising(result$value)) {            p <- promise_chain(setVisible(result), ..., catch = ca
tch,                 finally = finally)            runFinally <- FALSE            p        }        else {            result <- Reduce(function(v, func) {                if (".visible" %in% names(f
ormals(func))) {                  withVisible(func(v$value, .visible = v$visible))                }                else {                  withVisible(func(v$value))                }            },
list(...), result)            setVisible(result)        }    })}, error = function(e) {    if (!is.null(catch))         catch(e)    else stop(e)}, finally = if (runFinally && !is.null(finally)) fin
ally())
69: do()
70: hybrid_chain(shinyCallingHandlers(func()), catch = function(cond) {    if (inherits(cond, "shiny.custom.error")) {        if (isTRUE(getOption("show.error.messages")))             printError(co
nd)        structure(list(), class = "try-error", condition = cond)    }    else if (inherits(cond, "shiny.output.cancel")) {        structure(list(), class = "cancel-output")    }    else if (inhe
rits(cond, "shiny.silent.error")) {        structure(list(), class = "try-error", condition = cond)    }    else {        if (isTRUE(getOption("show.error.messages")))             printError(cond)
       if (getOption("shiny.sanitize.errors", FALSE)) {            cond <- simpleError(paste("An error has occurred. Check your",                 "logs or contact the app author for", "clarificatio
n."))        }        invisible(structure(list(), class = "try-error", condition = cond))    }})
71: force(expr)
72: withVisible(force(expr))
73: withCallingHandlers(expr, error = doCaptureStack)
74: globals$domain$wrapSync(expr)
75: promises::with_promise_domain(createStackTracePromiseDomain(),     expr)
76: captureStackTraces({    result <- withVisible(force(expr))    if (promises::is.promising(result$value)) {        p <- promise_chain(setVisible(result), ..., catch = catch,             finally =
 finally)        runFinally <- FALSE        p    }    else {        result <- Reduce(function(v, func) {            if (".visible" %in% names(formals(func))) {                withVisible(func(v$val
ue, .visible = v$visible))            }            else {                withVisible(func(v$value))            }        }, list(...), result)        setVisible(result)    }})
77: doTryCatch(return(expr), name, parentenv, handler)
78: tryCatchOne(expr, names, parentenv, handlers[[1L]])
79: tryCatchList(expr, classes, parentenv, handlers)
80: tryCatch({    captureStackTraces({        result <- withVisible(force(expr))        if (promises::is.promising(result$value)) {            p <- promise_chain(setVisible(result), ..., catch = ca
tch,                 finally = finally)            runFinally <- FALSE            p        }        else {            result <- Reduce(function(v, func) {                if (".visible" %in% names(f
ormals(func))) {                  withVisible(func(v$value, .visible = v$visible))                }                else {                  withVisible(func(v$value))                }            },
list(...), result)            setVisible(result)        }    })}, error = function(e) {    if (!is.null(catch))         catch(e)    else stop(e)}, finally = if (runFinally && !is.null(finally)) fin
ally())
81: do()
82: hybrid_chain(hybrid_chain(shinyCallingHandlers(func()), catch = function(cond) {    if (inherits(cond, "shiny.custom.error")) {        if (isTRUE(getOption("show.error.messages")))
printError(cond)        structure(list(), class = "try-error", condition = cond)    }    else if (inherits(cond, "shiny.output.cancel")) {        structure(list(), class = "cancel-output")    }
else if (inherits(cond, "shiny.silent.error")) {        structure(list(), class = "try-error", condition = cond)    }    else {        if (isTRUE(getOption("show.error.messages")))             prin
tError(cond)        if (getOption("shiny.sanitize.errors", FALSE)) {            cond <- simpleError(paste("An error has occurred. Check your",                 "logs or contact the app author for",
"clarification."))        }        invisible(structure(list(), class = "try-error", condition = cond))    }}), function(value) {    self$requestFlush()    private$sendMessage(recalculating = list(n
ame = name, status = "recalculated"))    if (inherits(value, "cancel-output")) {        return()    }    private$invalidatedOutputErrors$remove(name)    private$invalidatedOutputValues$remove(name)
    if (inherits(value, "try-error")) {        cond <- attr(value, "condition")        type <- setdiff(class(cond), c("simpleError", "error",             "condition"))        private$invalidatedOut
putErrors$set(name, list(message = cond$message,             call = utils::capture.output(print(cond$call)), type = if (length(type)) type))    }    else private$invalidatedOutputValues$set(name, v
alue)})
83: `<observer:output$phonePlot>`(...)
84: contextFunc()
85: env$runWith(self, func)
86: force(expr)
87: globals$domain$wrapSync(expr)
88: promises::with_promise_domain(createVarPromiseDomain(.globals,     "domain", domain), expr)
89: withReactiveDomain(.domain, {    env <- .getReactiveEnvironment()    .graphEnterContext(id)    on.exit(.graphExitContext(id), add = TRUE)    env$runWith(self, func)})
90: globals$domain$wrapSync(expr)
91: promises::with_promise_domain(reactivePromiseDomain(), {    withReactiveDomain(.domain, {        env <- .getReactiveEnvironment()        .graphEnterContext(id)        on.exit(.graphExitContext(
id), add = TRUE)        env$runWith(self, func)    })})
92: ctx$run(.func)
93: run()
94: withCallingHandlers(expr, error = doCaptureStack)
95: globals$domain$wrapSync(expr)
96: promises::with_promise_domain(createStackTracePromiseDomain(),     expr)
97: captureStackTraces(expr)
98: withCallingHandlers(captureStackTraces(expr), error = function(e) {    if (inherits(e, "shiny.silent.error"))         return()    handle <- getOption("shiny.error")    if (is.function(handle))
        handle()})
99: shinyCallingHandlers(run())
100: force(expr)
101: withVisible(force(expr))
102: withCallingHandlers(expr, error = doCaptureStack)
103: globals$domain$wrapSync(expr)
104: promises::with_promise_domain(createStackTracePromiseDomain(),     expr)
105: captureStackTraces({    result <- withVisible(force(expr))    if (promises::is.promising(result$value)) {        p <- promise_chain(setVisible(result), ..., catch = catch,             finally
= finally)        runFinally <- FALSE        p    }    else {        result <- Reduce(function(v, func) {            if (".visible" %in% names(formals(func))) {                withVisible(func(v$va
lue, .visible = v$visible))            }            else {                withVisible(func(v$value))            }        }, list(...), result)        setVisible(result)    }})
106: doTryCatch(return(expr), name, parentenv, handler)
107: tryCatchOne(expr, names, parentenv, handlers[[1L]])
108: tryCatchList(expr, classes, parentenv, handlers)
109: tryCatch({    captureStackTraces({        result <- withVisible(force(expr))        if (promises::is.promising(result$value)) {            p <- promise_chain(setVisible(result), ..., catch = c
atch,                 finally = finally)            runFinally <- FALSE            p        }        else {            result <- Reduce(function(v, func) {                if (".visible" %in% names(
formals(func))) {                  withVisible(func(v$value, .visible = v$visible))                }                else {                  withVisible(func(v$value))                }            },
 list(...), result)            setVisible(result)        }    })}, error = function(e) {    if (!is.null(catch))         catch(e)    else stop(e)}, finally = if (runFinally && !is.null(finally)) fi
nally())
110: do()
111: hybrid_chain({    if (!.destroyed) {        shinyCallingHandlers(run())    }}, catch = function(e) {    if (inherits(e, "shiny.silent.error")) {        return()    }    printError(e)    if (!i
s.null(.domain)) {        .domain$unhandledError(e)    }}, finally = .domain$decrementBusyCount)
112: flushCallback()
113: FUN(X[[i]], ...)
114: lapply(.flushCallbacks, function(flushCallback) {    flushCallback()})
115: ctx$executeFlushCallbacks()
116: .getReactiveEnvironment()$flush()
117: flushReact()
118: serviceApp()
119: ..stacktracefloor..(serviceApp())
120: withCallingHandlers(expr, error = doCaptureStack)
121: globals$domain$wrapSync(expr)
122: promises::with_promise_domain(createStackTracePromiseDomain(),     expr)
123: captureStackTraces({    while (!.globals$stopped) {        ..stacktracefloor..(serviceApp())        Sys.sleep(0.001)    }})
124: ..stacktraceoff..(captureStackTraces({    while (!.globals$stopped) {        ..stacktracefloor..(serviceApp())        Sys.sleep(0.001)    }}))
125: (function (appDir = getwd(), port = getOption("shiny.port"),     launch.browser = getOption("shiny.launch.browser", interactive()),     host = getOption("shiny.host", "127.0.0.1"), workerId =
"",     quiet = FALSE, display.mode = c("auto", "normal", "showcase"),     test.mode = getOption("shiny.testmode", FALSE)) {    on.exit({        handlerManager$clear()    }, add = TRUE)    if (.glo
bals$running) {        stop("Can't call `runApp()` from within `runApp()`. If your ",             "application code contains `runApp()`, please remove it.")    }    .globals$running <- TRUE    on.e
xit({        .globals$running <- FALSE    }, add = TRUE)    oldOptionSet <- .globals$options    on.exit({        .globals$options <- oldOptionSet    }, add = TRUE)    ops <- options(warn = max(1, g
etOption("warn", default = 1)),         pool.scheduler = scheduleTask)    on.exit(options(ops), add = TRUE)    appParts <- as.shiny.appobj(appDir)    appOps <- appParts$options    findVal <- functi
on(arg, default) {        if (arg %in% names(appOps))             appOps[[arg]]        else default    }    if (missing(port))         port <- findVal("port", port)    if (missing(launch.browser))
        launch.browser <- findVal("launch.browser", launch.browser)    if (missing(host))         host <- findVal("host", host)    if (missing(quiet))         quiet <- findVal("quiet", quiet)    if
 (missing(display.mode))         display.mode <- findVal("display.mode", display.mode)    if (missing(test.mode))         test.mode <- findVal("test.mode", test.mode)    if (is.null(host) || is.na(
host))         host <- "0.0.0.0"    workerId(workerId)    if (inShinyServer()) {        ver <- Sys.getenv("SHINY_SERVER_VERSION")        if (utils::compareVersion(ver, .shinyServerMinVersion) <
         0) {            warning("Shiny Server v", .shinyServerMinVersion,                 " or later is required; please upgrade!")        }    }    setShowcaseDefault(0)    .globals$testMode <- t
est.mode    if (test.mode) {        message("Running application in test mode.")    }    if (is.character(appDir)) {        desc <- file.path.ci(if (tolower(tools::file_ext(appDir)) ==
"r")             dirname(appDir)        else appDir, "DESCRIPTION")        if (file.exists(desc)) {            con <- file(desc, encoding = checkEncoding(desc))            on.exit(close(con), add =
 TRUE)            settings <- read.dcf(con)            if ("DisplayMode" %in% colnames(settings)) {                mode <- settings[1, "DisplayMode"]                if (mode == "Showcase") {
           setShowcaseDefault(1)                  if ("IncludeWWW" %in% colnames(settings)) {                    .globals$IncludeWWW <- as.logical(settings[1,                       "IncludeWWW"])
                  if (is.na(.globals$IncludeWWW)) {                      stop("In your Description file, `IncludeWWW` ",                         "must be set to `True` (default) or `False`")
             }                  }                  else {                    .globals$IncludeWWW <- TRUE                  }                }            }        }    }    if (is.null(.globals$Inclu
deWWW) || is.na(.globals$IncludeWWW)) {        .globals$IncludeWWW <- TRUE    }    display.mode <- match.arg(display.mode)    if (display.mode == "normal") {        setShowcaseDefault(0)    }    el
se if (display.mode == "showcase") {        setShowcaseDefault(1)    }    require(shiny)    if (is.null(port)) {        for (i in 1:20) {            if (!is.null(.globals$lastPort)) {
  port <- .globals$lastPort                .globals$lastPort <- NULL            }            else {                while (TRUE) {                  port <- p_randomInt(3000, 8000)                  i
f (!port %in% c(3659, 4045, 6000, 6665:6669,                     6697)) {                    break                  }                }            }            tmp <- try(startServer(host, port, lis
t()), silent = TRUE)            if (!inherits(tmp, "try-error")) {                stopServer(tmp)                .globals$lastPort <- port                break            }        }    }    on.exit
({        .globals$onStopCallbacks$invoke()        .globals$onStopCallbacks <- Callbacks$new()    }, add = TRUE)    unconsumeAppOptions(appParts$appOptions)    if (!is.null(appParts$onStop))
  on.exit(appParts$onStop(), add = TRUE)    if (!is.null(appParts$onStart))         appParts$onStart()    server <- startApp(appParts, port, host, quiet)    on.exit({        stopServer(server)    }
, add = TRUE)    if (!is.character(port)) {        browseHost <- if (identical(host, "0.0.0.0"))             "127.0.0.1"        else host        appUrl <- paste("http://", browseHost, ":", port, se
p = "")        if (is.function(launch.browser))             launch.browser(appUrl)        else if (launch.browser)             utils::browseURL(appUrl)    }    else {        appUrl <- NULL    }
callAppHook("onAppStart", appUrl)    on.exit({        callAppHook("onAppStop", appUrl)    }, add = TRUE)    .globals$reterror <- NULL    .globals$retval <- NULL    .globals$stopped <- FALSE    ..st
acktraceoff..(captureStackTraces({        while (!.globals$stopped) {            ..stacktracefloor..(serviceApp())            Sys.sleep(0.001)        }    }))    if (isTRUE(.globals$reterror)) {
     stop(.globals$retval)    }    else if (.globals$retval$visible)         .globals$retval$value    else invisible(.globals$retval$value)})(appDir = list(httpHandler = function (req) {    if (!id
entical(req$REQUEST_METHOD, "GET"))         return(NULL)    if (!isTRUE(grepl(uiPattern, req$PATH_INFO)))         return(NULL)    textConn <- file(open = "w+")    on.exit(close(textConn))    showca
seMode <- .globals$showcaseDefault    if (.globals$showcaseOverride) {        mode <- showcaseModeOfReq(req)        if (!is.null(mode))             showcaseMode <- mode    }    testMode <- .globals
$testMode %OR% FALSE    bookmarkStore <- getShinyOption("bookmarkStore", default = "disable")    if (bookmarkStore == "disable") {        restoreContext <- RestoreContext$new()    }    else {
  restoreContext <- RestoreContext$new(req$QUERY_STRING)    }    withRestoreContext(restoreContext, {        uiValue <- NULL        if (is.function(ui)) {            if (length(formals(ui)) > 0) {
               uiValue <- ..stacktraceon..(ui(req))            }            else {                uiValue <- ..stacktraceon..(ui())            }        }        else {            if (getCurrentRest
oreContext()$active) {                warning("Trying to restore saved app state, but UI code must be a function for this to work! See ?enableBookmarking")            }            uiValue <- ui
    }    })    if (is.null(uiValue))         return(NULL)    renderPage(uiValue, textConn, showcaseMode, testMode)    html <- paste(readLines(textConn, encoding = "UTF-8"), collapse = "\n")    retu
rn(httpResponse(200, content = enc2utf8(html)))}, serverFuncSource = function () {    server}, onStart = function () {    global_r <- file.path.ci(dir, "global.R")    if (file.exists(global_r)) {
      source(global_r, local = FALSE)    }    shiny::addResourcePath("rmd_resources", rmarkdown_system_file("rmd/h/rmarkdown"))}, options = list(), appOptions = list(appDir = "/opt/shiny-server/sam
ples/sample-apps/rmd",     bookmarkStore = NULL)), port = 37673L, launch.browser = FALSE)
126: do.call(shiny::runApp, shiny_args)
127: rmarkdown::run(file = NULL, dir = Sys.getenv("SHINY_APP"), shiny_args = list(port = port,     launch.browser = FALSE), auto_reload = FALSE)
An irrecoverable exception occurred. R is aborting now ...
-su: line 1:  7518 Segmentation fault      (core dumped) R --no-save --slave -f \/opt\/shiny-server\/R\/SockJSAdapter\.R

Thank you,

Sara

2 Likes

Hi @SaraJeanne08 and @jcheng ...did you happen to resolve this problem? I had an Rmd app with shiny runtime functioning on the server, moved the directory, and now the app errors out shortly after opening and returns a log traceback highly similar to the one @SaraJeanne08 posted. I appreciate any thoughts, and apologies for resurrecting an old topic.

Thanks,
Jacob