Pkgdown: Hitting segfault with plotting function documentation in R 4.0.4 / pkgdown 1.6.1

Created on 17 Feb 2021  路  12Comments  路  Source: r-lib/pkgdown

Hi, I upgraded to R 4.0.4, and now I'm hitting a segfault issue consistently for the plotting function plotCorrelation() in my AcidPlots package. This was rendering OK for me last week with R 4.0.3. Not sure how to debug this further.

Reading 'man/plotCellCounts.Rd'
Writing 'reference/plotCellCounts.html'
Reading 'man/plotCorrelation.Rd'
/
 *** caught segfault ***
address 0x14, cause 'memory not mapped'
-
Traceback:
 1: grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y,     resolveHJust(x$just, x$hjust), resolveVJust(x$just, x$vjust),     x$rot, x$check.overlap)
 2: drawDetails.text(x, recording = FALSE)
 3: drawDetails(x, recording = FALSE)
 4: drawGrob(x)
 5: recordGraphics(drawGrob(x), list(x = x), getNamespace("grid"))
 6: grid.draw.grob(x$children[[i]], recording = FALSE)
 7: grid.draw(x$children[[i]], recording = FALSE)
 8: drawGTree(x)
 9: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
10: grid.draw.gTree(x$children[[i]], recording = FALSE)
11: grid.draw(x$children[[i]], recording = FALSE)
12: drawGTree(x)
13: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
14: grid.draw.gTree(gtable)
15: grid.draw(gtable)
16: print.ggplot(x)
17: print(x)
18: value_handler(x)
19: value_fun(ev$value, ev$visible)
20: withVisible(value_fun(ev$value, ev$visible))
21: withCallingHandlers(withVisible(value_fun(ev$value, ev$visible)),     warning = wHandler, error = eHandler, message = mHandler)
22: doTryCatch(return(expr), name, parentenv, handler)
23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
24: tryCatchList(expr, classes, parentenv, handlers)
25: 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        sm <- strsplit(conditionMessage(e), "\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 && utFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
26: try(f, silent = TRUE)
27: handle(pv <- withCallingHandlers(withVisible(value_fun(ev$value,     ev$visible)), warning = wHandler, error = eHandler, message = mHandler))
28: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,     debug = debug, last = i == length(out), use_try = stop_on_error !=         2L, keep_warning = keep_warning, keep_message = keep_message,     output_handler = output_handler, include_timing = include_timing)
29: evaluate::evaluate(code, child_env(env), new_device = TRUE)
30: downlit::evaluate_and_highlight(code, fig_save = fig_save_topic,     env = child_env(env))
31: highlight_examples(code, topic, env = env)
32: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()),     topic = tools::file_path_sans_ext(topic$file_in), run_examples = examples,     run_dont_run = run_dont_run)
33: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run)
34: withCallingHandlers(data_reference_topic(topic, pkg, examples = examples,     run_dont_run = run_dont_run), error = function(err) {    msg <- c(paste0("Failed to parse Rd in ", topic$file_in),         i = err$message)    abort(msg, parent = err)})
35: .f(.x[[i]], ...)
36: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy,     examples = examples, run_dont_run = run_dont_run)

Any help would be appreciated!

Best,
Mike

Most helpful comment

This is an unfortunate bug in ragg - I'll submit a fix today

All 12 comments

I'd start by attempting to recreate the problem outside of pkgdown, as it's relatiely unlikely that it's pkgdown's fault.

Thanks @hadley , I'm seeing if I can make a more minimal reprex outside of pkgdown. The function is passing all of the other build checks.

In case it helps, I can reproduce the segfault in Actions: https://github.com/zonebuilders/zonebuilder/runs/1939094433#step:9:40

Latest run suggests it's not version specific: https://github.com/zonebuilders/zonebuilder/runs/1939334825

Given that the segfaults appear in happen in graphics calls it鈥檚 possible this is a bug in ragg. So maybe try running that example using ragg as a graphics device?

Given that the segfaults appear in happen in graphics calls it鈥檚 possible this is a bug in ragg. So maybe try running that example using ragg as a graphics device?

Good suggestion, will give it a spin.

Update, I assumed from the logs it was the zb_doughnut() example that was causing the issue. But couldn't reproduce the crash:

remotes::install_cran("zonebuilder")
#> Skipping install of 'zonebuilder' from a cran remote, the SHA1 (0.0.1) has not changed since last install.
#>   Use `force = TRUE` to force installation
library(zonebuilder)
file = tempfile(fileext = ".png")
ragg::agg_png(file, width = 1000, height = 500, res = 144)
zb_plot(zb_doughnut(london_c(), london_a()))
invisible(dev.off())

Created on 2021-02-20 by the reprex package (v1.0.0)

Another potential clue: I could not reproduce the issue when building the site on my local machine. Session Info below - could it be a ragg/Mac issue?

Session info:

sessionInfo()
#> R version 4.0.4 (2021-02-15)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 18.04.5 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
#> 
#> locale:
#>  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
#>  [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
#>  [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] crayon_1.4.1      digest_0.6.27     backports_1.2.1   lifecycle_1.0.0  
#>  [5] reprex_1.0.0      magrittr_2.0.1    evaluate_0.14     pillar_1.4.7     
#>  [9] highr_0.8         stringi_1.5.3     rlang_0.4.10      fs_1.5.0         
#> [13] vctrs_0.3.6.9000  ellipsis_0.3.1    rmarkdown_2.6     styler_1.3.2.9000
#> [17] tools_4.0.4       stringr_1.4.0     glue_1.4.2        purrr_0.3.4      
#> [21] xfun_0.21         yaml_2.2.1        compiler_4.0.4    pkgconfig_2.0.3  
#> [25] htmltools_0.5.1.1 knitr_1.31        tibble_3.0.6

Created on 2021-02-20 by the reprex package (v1.0.0)

FWIW, I am hitting the same issue:

  • when running build_site() on a Mac locally (R 4.0.4, MacOS 11.2, CRAN version of {ragg} & friends)
  • on GHA.

No error when I run the offending example code interactively in RStudio with ragg as the graphics backend.

Having the same issue here. I'm not sure why it's happening but it's the exact same error while building the pkgdown site with Github Actions. Could it be that patchwork using ragg needs an update on their side? Is it an R-4.0.4 related issue? This is the error I get:

...
Reading 'man/dft.Rd'
Reading 'man/dist2d.Rd'
Reading 'man/distr.Rd'

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

Traceback:
 1: grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y,     resolveHJust(x$just, x$hjust), resolveVJust(x$just, x$vjust),     x$rot, x$check.overlap)
 2: drawDetails.text(x, recording = FALSE)
 3: drawDetails(x, recording = FALSE)
 4: drawGrob(x)
 5: recordGraphics(drawGrob(x), list(x = x), getNamespace("grid"))
 6: grid.draw.grob(x$children[[i]], recording = FALSE)
 7: grid.draw(x$children[[i]], recording = FALSE)
 8: drawGTree(x)
 9: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
10: grid.draw.gTree(x$children[[i]], recording = FALSE)
11: grid.draw(x$children[[i]], recording = FALSE)
12: drawGTree(x)
13: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
14: grid.draw.gTree(gtable)
15: grid.draw(gtable)
16: print.patchwork(x)
17: print(x)
18: value_handler(x)
19: value_fun(ev$value, ev$visible)
20: withVisible(value_fun(ev$value, ev$visible))
21: withCallingHandlers(withVisible(value_fun(ev$value, ev$visible)),     warning = wHandler, error = eHandler, message = mHandler)
22: doTryCatch(return(expr), name, parentenv, handler)
23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
24: tryCatchList(expr, classes, parentenv, handlers)
25: 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        sm <- strsplit(conditionMessage(e), "\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 && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
26: try(f, silent = TRUE)
27: handle(pv <- withCallingHandlers(withVisible(value_fun(ev$value,     ev$visible)), warning = wHandler, error = eHandler, message = mHandler))
28: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,     debug = debug, last = i == length(out), use_try = stop_on_error !=         2L, keep_warning = keep_warning, keep_message = keep_message,     output_handler = output_handler, include_timing = include_timing)
29: evaluate::evaluate(code, child_env(env), new_device = TRUE)
30: downlit::evaluate_and_highlight(code, fig_save = fig_save_topic,     env = child_env(env))
31: highlight_examples(code, topic, env = env)
32: run_examples(tags$tag_examples[[1]], env = new.env(parent = globalenv()),     topic = tools::file_path_sans_ext(topic$file_in), run_examples = examples,     run_dont_run = run_dont_run)
33: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run)
34: withCallingHandlers(data_reference_topic(topic, pkg, examples = examples,     run_dont_run = run_dont_run), error = function(err) {    msg <- c(paste0("Failed to parse Rd in ", topic$file_in),         i = err$message)    abort(msg, parent = err)})
35: .f(.x[[i]], ...)
36: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy,     examples = examples, run_dont_run = run_dont_run)
37: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run,     seed = seed, override = override, preview = FALSE, devel = devel)
38: build_site_local(pkg = pkg, examples = examples, run_dont_run = run_dont_run,     seed = seed, lazy = lazy, override = override, preview = preview,     devel = devel)
39: build_site(pkg, devel = FALSE, preview = FALSE, install = FALSE,     ...)
40: pkgdown::deploy_to_branch(new_process = FALSE)
An irrecoverable exception occurred. R is aborting now ...
Error: Process completed with exit code 139.

This is an unfortunate bug in ragg - I'll submit a fix today

on it's way to cran

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ycphs picture ycphs  路  6Comments

GegznaV picture GegznaV  路  9Comments

jeffwong picture jeffwong  路  9Comments

nschiett picture nschiett  路  6Comments

stufield picture stufield  路  5Comments