追踪R段错误的根本原因

时间:2015-04-26 20:35:12

标签: r ggplot2 shiny

我使用Shiny和ggplot2处理用R编写的非常复杂的仪表板。

目前编写的所有内容都运行良好,但过了一段时间(数据每天更新),它在渲染特定页面时开始出现段错误。

我可以通过打开12 ggplot图表的特定标签重现问题。

失败时的控制台输出如下所示:

dashboard_1 | address 0x194b1, cause 'memory not mapped'
dashboard_1 | 
dashboard_1 | Traceback:
dashboard_1 |  1: mapply(FUN = f, ..., SIMPLIFY = FALSE)
dashboard_1 |  2: Map(build_grob, plot$layer, data)
dashboard_1 |  3: ggplot_gtable(data)
dashboard_1 |  4: print.ggplot(result$value)
dashboard_1 |  5: print(result$value)
dashboard_1 |  6: eval(expr, envir, enclos)
dashboard_1 |  7: eval(expr, pf)
dashboard_1 |  8: withVisible(eval(expr, pf))
dashboard_1 |  9: evalVis(expr)
dashboard_1 | 10: capture.output(print(result$value))
...
dashboard_1 | 65: tryCatchOne(expr, names, parentenv, handlers[[1L]])
dashboard_1 | 66: tryCatchList(expr, classes, parentenv, handlers)
dashboard_1 | 67: 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()        }    }})("62978544", FALSE, "{\"method\":\"update\",\"data\":{\"daterange:shiny.date\":[\"2014-04-26\",\"2015-04-26\"],\"group_by\":\"weeks\"}}"),     <environment>), error = .rcpp_error_recorder)
dashboard_1 | 68: withCallingHandlers(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()        }    }})("62978544", FALSE, "{\"method\":\"update\",\"data\":{\"daterange:shiny.date\":[\"2014-04-26\",\"2015-04-26\"],\"group_by\":\"weeks\"}}"),     <environment>), error = .rcpp_error_recorder), warning = .rcpp_warning_recorder)
dashboard_1 | aborting ...
dashboard_1 | Segmentation fault
rmreports_dashboard_1 exited with code 139

我想跟踪根本原因并引入更改以防止发生段错误。解决这个问题的最佳方法是什么?

1 个答案:

答案 0 :(得分:1)

我正在搜索你的问题能够找到这个帖子。 https://github.com/hadley/dplyr/issues/322 其中说试图用'devtools'更新'dplyr'。 “devtools :: install_github(”hadley / dplyr“,build_vignettes = FALSE)”