r-tmap/tmaptools

segfault at launch of `palette_explorer()`

Closed this issue · 2 comments

When I launch palette_explorer in a clean session, I get a segfault:

> library(tmaptools)
> palette_explorer()
Loading required namespace: shiny
Loading required namespace: shinyjs
Le chargement a nécessité le package : shiny

Listening on http://127.0.0.1:6769
Warning in body(fun) : argument is not a function

 *** caught segfault ***
address 0xb7, 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: (function (func, filename = tempfile(fileext = ".png"), width = 400,     height = 400, res = 72, ...) {    if (capabilities("aqua")) {        pngfun <- grDevices::png    }    else if ((getOption("shiny.usecairo") %OR% TRUE) && nchar(system.file(package = "Cairo"))) {        pngfun <- Cairo::CairoPNG    }    else {        pngfun <- grDevices::png    }    pngfun(filename = filename, width = width, height = height,         res = res, ...)    op <- graphics::par(mar = rep(0, 4))    tryCatch(graphics::plot.new(), finally = graphics::par(op))    dv <- grDevices::dev.cur()    on.exit(grDevices::dev.off(dv), add = TRUE)    func()    filename})(function () {    success <- FALSE    tryCatch({        grDevices::dev.control(displaylist = "enable")        result <- withVisible(func())        success <- TRUE    }, finally = {        if (!success) {            getDims()        }    })    if (result$visible) {        utils::capture.output({            plotResult <<- ..stacktraceon..(print(result$value))        })    }    recordedPlot <<- grDevices::recordPlot()    if (inherits(plotResult, "ggplot_build_gtable")) {        coordmap <<- getGgplotCoordmap(plotResult, pixelratio,             res)    }    else {        coordmap <<- getPrevPlotCoordmap(dims$width, dims$height)    }}, width = 1230L, height = 285L, res = 72)
 5: do.call(plotPNG, c(plotFunc, width = dims$width * pixelratio,     height = dims$height * pixelratio, res = res * pixelratio,     args))
 6: ..stacktraceoff..(do.call(plotPNG, c(plotFunc, width = dims$width *     pixelratio, height = dims$height * pixelratio, res = res *     pixelratio, args)))
 7: `<reactive:plotObj>`(...)
 8: ..stacktraceon..(`<reactive:plotObj>`(...))
 9: .func()
10: withVisible(.func())
11: withCallingHandlers({    .error <<- FALSE    withVisible(.func())}, error = function(cond) {    .value <<- cond    .error <<- TRUE    .visible <<- FALSE})
12: contextFunc()
13: env$runWith(self, func)
14: withReactiveDomain(.domain, {    env <- .getReactiveEnvironment()    .graphEnterContext(id)    on.exit(.graphExitContext(id), add = TRUE)    env$runWith(self, func)})
15: ctx$run(function() {    result <- withCallingHandlers({        .error <<- FALSE        withVisible(.func())    }, error = function(cond) {        .value <<- cond        .error <<- TRUE        .visible <<- FALSE    })    .value <<- result$value    .visible <<- result$visible})
16: self$.updateValue()
17: ..stacktraceoff..(self$.updateValue())
18: plotObj()
19: origRenderFunc(...)
20: `output$plot_seq`(...)
21: ..stacktraceon..(`output$plot_seq`(...))
22: orig(name = name, shinysession = self)
23: func()
24: withCallingHandlers(expr, error = function(e) {    if (is.null(attr(e, "stack.trace", exact = TRUE))) {        calls <- sys.calls()        attr(e, "stack.trace") <- calls        stop(e)    }})
25: captureStackTraces(expr)
26: withCallingHandlers(captureStackTraces(expr), error = function(e) {    if (inherits(e, "shiny.silent.error"))         return()    handle <- getOption("shiny.error")    if (is.function(handle))         handle()})
27: shinyCallingHandlers(func())
28: doTryCatch(return(expr), name, parentenv, handler)
29: tryCatchOne(expr, names, parentenv, handlers[[1L]])
30: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
31: doTryCatch(return(expr), name, parentenv, handler)
32: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
33: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
34: doTryCatch(return(expr), name, parentenv, handler)
35: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
36: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
37: doTryCatch(return(expr), name, parentenv, handler)
38: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
39: tryCatchList(expr, classes, parentenv, handlers)
40: tryCatch(shinyCallingHandlers(func()), shiny.custom.error = function(cond) {    if (isTRUE(getOption("show.error.messages")))         printError(cond)    structure(list(), class = "try-error", condition = cond)}, shiny.output.cancel = function(cond) {    structure(list(), class = "cancel-output")}, shiny.silent.error = function(cond) {    structure(list(), class = "try-error", condition = cond)}, error = function(cond) {    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", "clarification."))    }    invisible(structure(list(), class = "try-error", condition = cond))}, finally = {    private$sendMessage(recalculating = list(name = name, status = "recalculated"))})
41: observerFunc()
42: doTryCatch(return(expr), name, parentenv, handler)
43: tryCatchOne(expr, names, parentenv, handlers[[1L]])
44: tryCatchList(expr, classes, parentenv, handlers)
45: tryCatch(if (..stacktraceon) ..stacktraceon..(observerFunc()) else observerFunc(),     shiny.silent.error = function(e) NULL)
46: contextFunc()
47: env$runWith(self, func)
48: withReactiveDomain(.domain, {    env <- .getReactiveEnvironment()    .graphEnterContext(id)    on.exit(.graphExitContext(id), add = TRUE)    env$runWith(self, func)})
49: ctx$run(.func)
50: run()
51: withCallingHandlers(expr, error = function(e) {    if (is.null(attr(e, "stack.trace", exact = TRUE))) {        calls <- sys.calls()        attr(e, "stack.trace") <- calls        stop(e)    }})
52: captureStackTraces(expr)
53: withCallingHandlers(captureStackTraces(expr), error = function(e) {    if (inherits(e, "shiny.silent.error"))         return()    handle <- getOption("shiny.error")    if (is.function(handle))         handle()})
54: shinyCallingHandlers(run())
55: doTryCatch(return(expr), name, parentenv, handler)
56: tryCatchOne(expr, names, parentenv, handlers[[1L]])
57: tryCatchList(expr, classes, parentenv, handlers)
58: tryCatch({    if (!.destroyed)         shinyCallingHandlers(run())}, error = function(e) {    printError(e)    if (!is.null(.domain)) {        .domain$unhandledError(e)    }})
59: flushCallback()
60: FUN(X[[i]], ...)
61: lapply(.flushCallbacks, function(flushCallback) {    flushCallback()})
62: ctx$executeFlushCallbacks()
63: .getReactiveEnvironment()$flush()
64: flushReact()
65: force(expr)
66: withRestoreContext(shinysession$restoreContext, {    msg$data <- applyInputHandlers(msg$data)    switch(msg$method, init = {        serverFunc <- withReactiveDomain(NULL, serverFuncSource())        if (!identicalFunctionBodies(serverFunc, appvars$server)) {            appvars$server <- serverFunc            if (!is.null(appvars$server)) {                attr(appvars$server, "shinyServerFunction") <- TRUE                registerDebugHook("server", appvars, "Server Function")            }        }        if (.globals$showcaseOverride && exists(".clientdata_url_search",             where = msg$data)) {            mode <- showcaseModeOfQuerystring(msg$data$.clientdata_url_search)            if (!is.null(mode)) shinysession$setShowcase(mode)        }        shinysession$manageInputs(msg$data)        if (!is.null(msg$data$.clientdata_singletons)) {            shinysession$singletons <- strsplit(msg$data$.clientdata_singletons,                 ",")[[1]]        }        local({            args <- argsForServerFunc(serverFunc, shinysession)            withReactiveDomain(shinysession, {                do.call(wrapFunctionLabel(appvars$server, "server",                   ..stacktraceon = TRUE), args)            })        })    }, update = {        shinysession$manageInputs(msg$data)    }, shinysession$dispatch(msg))    shinysession$manageHiddenOutputs()    if (exists(".shiny__stdout", globalenv()) && exists("HTTP_GUID",         ws$request)) {        shiny_stdout <- get(".shiny__stdout", globalenv())        writeLines(paste("_n_flushReact ", get("HTTP_GUID", ws$request),             " @ ", sprintf("%.3f", as.numeric(Sys.time())), sep = ""),             con = shiny_stdout)        flush(shiny_stdout)        flushReact()        writeLines(paste("_x_flushReact ", get("HTTP_GUID", ws$request),             " @ ", sprintf("%.3f", as.numeric(Sys.time())), sep = ""),             con = shiny_stdout)        flush(shiny_stdout)    }    else {        flushReact()    }    flushAllSessions()})
67: withReactiveDomain(shinysession, {    if (is.character(msg))         msg <- charToRaw(msg)    traceOption <- getOption("shiny.trace", FALSE)    if (isTRUE(traceOption) || traceOption == "recv") {        if (binary)             message("RECV ", "$$binary data$$")        else message("RECV ", rawToChar(msg))    }    if (identical(charToRaw("\003\xe9"), msg))         return()    msg <- decodeMessage(msg)    if (is.null(shinysession$restoreContext)) {        bookmarkStore <- getShinyOption("bookmarkStore", default = "disable")        if (bookmarkStore == "disable") {            shinysession$restoreContext <- RestoreContext$new()        }        else {            shinysession$restoreContext <- RestoreContext$new(msg$data$.clientdata_url_search)        }    }    withRestoreContext(shinysession$restoreContext, {        msg$data <- applyInputHandlers(msg$data)        switch(msg$method, init = {            serverFunc <- withReactiveDomain(NULL, serverFuncSource())            if (!identicalFunctionBodies(serverFunc, appvars$server)) {                appvars$server <- serverFunc                if (!is.null(appvars$server)) {                  attr(appvars$server, "shinyServerFunction") <- TRUE                  registerDebugHook("server", appvars, "Server Function")                }            }            if (.globals$showcaseOverride && exists(".clientdata_url_search",                 where = msg$data)) {                mode <- showcaseModeOfQuerystring(msg$data$.clientdata_url_search)                if (!is.null(mode)) shinysession$setShowcase(mode)            }            shinysession$manageInputs(msg$data)            if (!is.null(msg$data$.clientdata_singletons)) {                shinysession$singletons <- strsplit(msg$data$.clientdata_singletons,                   ",")[[1]]            }            local({                args <- argsForServerFunc(serverFunc, shinysession)                withReactiveDomain(shinysession, {                  do.call(wrapFunctionLabel(appvars$server, "server",                     ..stacktraceon = TRUE), args)                })            })        }, update = {            shinysession$manageInputs(msg$data)        }, shinysession$dispatch(msg))        shinysession$manageHiddenOutputs()        if (exists(".shiny__stdout", globalenv()) && exists("HTTP_GUID",             ws$request)) {            shiny_stdout <- get(".shiny__stdout", globalenv())            writeLines(paste("_n_flushReact ", get("HTTP_GUID",                 ws$request), " @ ", sprintf("%.3f", as.numeric(Sys.time())),                 sep = ""), con = shiny_stdout)            flush(shiny_stdout)            flushReact()            writeLines(paste("_x_flushReact ", get("HTTP_GUID",                 ws$request), " @ ", sprintf("%.3f", as.numeric(Sys.time())),                 sep = ""), con = shiny_stdout)            flush(shiny_stdout)        }        else {            flushReact()        }        flushAllSessions()    })})
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()        }    }})("111003200", FALSE, "{\"method\":\"init\",\"data\":{\"direct_tmap\":\"Direct code\",\"col_blind\":\"normal\",\"m_seq\":7,\"m_cat\":8,\"m_div\":9,\"auto_seq\":true,\"stretch\":true,\"auto_div\":true,\"hex\":false,\".clientdata_output_plot_seq_width\":1230,\".clientdata_output_plot_seq_height\":285,\".clientdata_output_plot_cat_width\":1230,\".clientdata_output_plot_cat_height\":131,\".clientdata_output_plot_div_width\":1230,\".clientdata_output_plot_div_height\":147,\".clientdata_output_contrast_seq_slider_hidden\":false,\".clientdata_output_contrast_div_slider_hidden\":false,\".clientdata_output_plot_seq_hidden\":false,\".clientdata_output_code_seq_hidden\":false,\".clientdata_output_plot_cat_hidden\":false,\".clientdata_output_code_cat_hidden\":false,\".clientdata_output_plot_div_hidden\":false,\".clientdata_output_code_div_hidden\":false,\".clientdata_pixelratio\":1,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"127.0.0.1\",\".clientdata_url_port\":\"6769\",\".clientdata_url_pathname\":\"/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"12b282b6c4e1ec3cee386f4ca6165aafc4731a84\",\".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()        }    }})("111003200", FALSE, "{\"method\":\"init\",\"data\":{\"direct_tmap\":\"Direct code\",\"col_blind\":\"normal\",\"m_seq\":7,\"m_cat\":8,\"m_div\":9,\"auto_seq\":true,\"stretch\":true,\"auto_div\":true,\"hex\":false,\".clientdata_output_plot_seq_width\":1230,\".clientdata_output_plot_seq_height\":285,\".clientdata_output_plot_cat_width\":1230,\".clientdata_output_plot_cat_height\":131,\".clientdata_output_plot_div_width\":1230,\".clientdata_output_plot_div_height\":147,\".clientdata_output_contrast_seq_slider_hidden\":false,\".clientdata_output_contrast_div_slider_hidden\":false,\".clientdata_output_plot_seq_hidden\":false,\".clientdata_output_code_seq_hidden\":false,\".clientdata_output_plot_cat_hidden\":false,\".clientdata_output_code_cat_hidden\":false,\".clientdata_output_plot_div_hidden\":false,\".clientdata_output_code_div_hidden\":false,\".clientdata_pixelratio\":1,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"127.0.0.1\",\".clientdata_url_port\":\"6769\",\".clientdata_url_pathname\":\"/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"12b282b6c4e1ec3cee386f4ca6165aafc4731a84\",\".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()        }    }})("111003200", FALSE, "{\"method\":\"init\",\"data\":{\"direct_tmap\":\"Direct code\",\"col_blind\":\"normal\",\"m_seq\":7,\"m_cat\":8,\"m_div\":9,\"auto_seq\":true,\"stretch\":true,\"auto_div\":true,\"hex\":false,\".clientdata_output_plot_seq_width\":1230,\".clientdata_output_plot_seq_height\":285,\".clientdata_output_plot_cat_width\":1230,\".clientdata_output_plot_cat_height\":131,\".clientdata_output_plot_div_width\":1230,\".clientdata_output_plot_div_height\":147,\".clientdata_output_contrast_seq_slider_hidden\":false,\".clientdata_output_contrast_div_slider_hidden\":false,\".clientdata_output_plot_seq_hidden\":false,\".clientdata_output_code_seq_hidden\":false,\".clientdata_output_plot_cat_hidden\":false,\".clientdata_output_code_cat_hidden\":false,\".clientdata_output_plot_div_hidden\":false,\".clientdata_output_code_div_hidden\":false,\".clientdata_pixelratio\":1,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"127.0.0.1\",\".clientdata_url_port\":\"6769\",\".clientdata_url_pathname\":\"/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"12b282b6c4e1ec3cee386f4ca6165aafc4731a84\",\".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()        }    }})("111003200", FALSE, "{\"method\":\"init\",\"data\":{\"direct_tmap\":\"Direct code\",\"col_blind\":\"normal\",\"m_seq\":7,\"m_cat\":8,\"m_div\":9,\"auto_seq\":true,\"stretch\":true,\"auto_div\":true,\"hex\":false,\".clientdata_output_plot_seq_width\":1230,\".clientdata_output_plot_seq_height\":285,\".clientdata_output_plot_cat_width\":1230,\".clientdata_output_plot_cat_height\":131,\".clientdata_output_plot_div_width\":1230,\".clientdata_output_plot_div_height\":147,\".clientdata_output_contrast_seq_slider_hidden\":false,\".clientdata_output_contrast_div_slider_hidden\":false,\".clientdata_output_plot_seq_hidden\":false,\".clientdata_output_code_seq_hidden\":false,\".clientdata_output_plot_cat_hidden\":false,\".clientdata_output_code_cat_hidden\":false,\".clientdata_output_plot_div_hidden\":false,\".clientdata_output_code_div_hidden\":false,\".clientdata_pixelratio\":1,\".clientdata_url_protocol\":\"http:\",\".clientdata_url_hostname\":\"127.0.0.1\",\".clientdata_url_port\":\"6769\",\".clientdata_url_pathname\":\"/\",\".clientdata_url_search\":\"\",\".clientdata_url_hash_initial\":\"\",\".clientdata_url_hash\":\"\",\".clientdata_singletons\":\"12b282b6c4e1ec3cee386f4ca6165aafc4731a84\",\".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: (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 (.globals$running) {        stop("Can't call `runApp()` from within `runApp()`. If your ",             "application code contains `runApp()`, please remove it.")    }    .globals$running <- TRUE    on.exit({        .globals$running <- FALSE    }, add = TRUE)    oldOptionSet <- .globals$options    on.exit({        .globals$options <- oldOptionSet    }, add = TRUE)    ops <- options(warn = 1, pool.scheduler = scheduleTask)    on.exit(options(ops), add = TRUE)    appParts <- as.shiny.appobj(appDir)    appOps <- appParts$options    findVal <- function(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 <- test.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$IncludeWWW) || is.na(.globals$IncludeWWW)) {        .globals$IncludeWWW <- TRUE    }    display.mode <- match.arg(display.mode)    if (display.mode == "normal") {        setShowcaseDefault(0)    }    else 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)                  if (!port %in% c(3659, 4045, 6000, 6665:6669)) {                    break                  }                }            }            tmp <- try(startServer(host, port, list()), silent = TRUE)            if (!inherits(tmp, "try-error")) {                stopServer(tmp)                .globals$lastPort <- port                break            }        }    }    unconsumeAppOptions(appParts$appOptions)    if (!is.null(appParts$onEnd))         on.exit(appParts$onEnd(), 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, sep = "")        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    ..stacktraceoff..(captureStackTraces({        scheduleFlush()        while (!.globals$stopped) {            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)})(list(httpHandler = function (req) {    if (!identical(req$REQUEST_METHOD, "GET"))         return(NULL)    if (!isTRUE(grepl(uiPattern, req$PATH_INFO)))         return(NULL)    textConn <- file(open = "w+")    on.exit(close(textConn))    showcaseMode <- .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 (getCurrentRestoreContext()$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")    return(httpResponse(200, content = enc2utf8(html)))}, serverFuncSource = function () {    server}, onStart = NULL, options = list(), appOptions = list(appDir = "/home/joel",     bookmarkStore = NULL)))
97: do.call(runApp, args)
98: print.shiny.appobj(x)
99: function (x, ...) UseMethod("print")(x)

Here is my sessionInfo():

R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

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

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

other attached packages:
[1] tmaptools_1.2

loaded via a namespace (and not attached):
 [1] spdep_0.6-12           Rcpp_0.12.10           rmapshaper_0.2.0.9000 
 [4] raster_2.5-8           magrittr_1.5           gmodels_2.16.2        
 [7] splines_3.4.0          MASS_7.3-47            geosphere_1.5-5       
[10] jsonvalidate_1.0.0     lattice_0.20-35        dichromat_2.0-0       
[13] rgdal_1.2-7            grid_3.4.0             nlme_3.1-131          
[16] KernSmooth_2.23-15     coda_0.19-1            e1071_1.6-8           
[19] deldir_0.1-14          gtools_3.5.0           rgeos_0.3-23          
[22] class_7.3-14           Matrix_1.2-8           osmar_1.1-7           
[25] RColorBrewer_1.1-2     bitops_1.0-6           RCurl_1.95-4.8        
[28] curl_2.5               sp_1.2-4               V8_1.5                
[31] gdata_2.17.0           compiler_3.4.0         LearnBayes_2.15       
[34] boot_1.3-19            classInt_0.1-24        geojsonlint_0.2.2.9100
[37] XML_3.98-1.6           expm_0.999-2           jsonlite_1.4  

Seems a general shiny/R bug: rstudio/shiny#1676