Github Actions tests fail exclusively on Mac, may be related to rlang::check_installed()?

Hi folks,

Having a mysterious issue w/ my package tests. See:

chore: update R CMD check · davidcarslaw/openairmaps@c1869ec

*** caught segfault ***
address 0x2068637573206f6e, cause 'invalid permissions'

The issue seems to kick in with the rlang::check_installed function:

24: rlang::check_installed(c("ggplot2", "ggspatial", "prettymapr", "ggtext"))

This only occurs for the Mac run - Windows / Linux are both fine and can run the test.

I don't know if there are any GitHub actions wizards that can explain what may be occurring!

Jack

This is a crash that happens when one of those packages is loaded:

Traceback:
 1: dyn.load(file, DLLpath = DLLpath, ...)
 2: library.dynam(lib, package, package.lib)
 3: loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])

Unfortunately I can't say which one.

First I would delete the cached packages, to eliminate the possibility that this is caused by an older cached packages that is not compatible with the current R release or other packages for some reason.

Hi Gabor,

Thanks for the reply.

I've tried clearing the MacOS cache and re-running (chore: update R CMD check · davidcarslaw/openairmaps@c1869ec) but it still seems like it failed.

I can't reproduce this on macOS locally, so it is hard to say what's going on.

You can try to log in to the VM to debug this interactively, I suggest you try to add this action to your workflow, and follow the instructions:

Curiously, I've removed the ggspatial/etc. tests and now MacOS fails purely with ggplot2:

test: remove other static tests, for now · davidcarslaw/openairmaps@63d9f55

The test literally just takes a theme:

theme_static <- function() {
  ggplot2::`%+replace%`(
    ggplot2::theme_minimal(),
    ggplot2::theme(panel.border = ggplot2::element_rect(fill = NA, color = "black"))
  )
}

and adds it to a ggplot2::ggplot() object

test_that("theme can be added to a ggplot2 object", {
  testthat::expect_no_error(
    ggplot2::ggplot() + theme_static()
  )
})

All the tests that failed seem to have something to do with producing a plot (the other test return data or leaflet maps). And still only on MacOS.

@Gabor - thanks for all your help here - using SSH I was able to work out that the issue seemed to be with the cairo graphics device?

When I switched from cairo to {ragg} in an internal function within the package that was saving images to a temporary directory it began working perfectly.

(the package saves down plots to use as {leaflet} markers, and was using grDevices::png() before, but now uses ragg::agg_png() - this mysteriously resolved everything!)

Great! It is possible that using the Cairo device needs X11. E.g. on macOS would need to install XQuartz: GitHub - r-lib/actions: GitHub Actions for the R community

But indeed if you want to create images in an automated way, then ragg is a great solution.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.