caught segfault - address (nil), cause 'memory not mapped' when using blend
simoncmo opened this issue · comments
I was trying the package using DEMO
First normal ggplot without blend function works and plot fine,
but the segmentation fault Error shows up when I start using the blend function
df |>
ggplot(aes(x, y, color = set)) +
geom_point(size = 3) |> blend("darken") +
scale_color_brewer(palette = "Set2") +
facet_grid(~ order) +
ggtitle("Scatterplot with blend('darken'): draw order does not matter")
this can be saved as p fine. but the error shows up again when trying to print the ggplot.
Error:
*** caught segfault ***
address (nil), cause 'memory not mapped'
Traceback:
1: .defineGroup(grp$src, grp$op, grp$dst)
2: drawDetails.GridGroup(x, recording = FALSE)
3: drawDetails(x, recording = FALSE)
4: drawGTree(x)
5: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
6: grid.draw.gTree(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(x$children[[i]], recording = FALSE)
15: grid.draw(x$children[[i]], recording = FALSE)
16: drawGTree(x)
17: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
18: grid.draw.gTree(gtable)
19: grid.draw(gtable)
20: print.ggplot(x)
21: (function (x, ...) UseMethod("print"))(x)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
I have been using new conda environment with either 4.2.0 and 4.2.2 but the error persist.
Here's the sessionInfo using 4.2.0 version of R.
Would love to hear if anyone encounter this and/or have solution. Thanks!
sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: {SomePath}/miniconda3/envs/ggblend/lib/libopenblasp-r0.3.21.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggblend_0.0.0.9000 ggplot2_3.4.0
loaded via a namespace (and not attached):
[1] fansi_1.0.3 withr_2.5.0 dplyr_1.0.10 utf8_1.2.2
[5] grid_4.2.0 R6_2.5.1 lifecycle_1.0.3 jsonlite_1.8.4
[9] gtable_0.3.1 magrittr_2.0.3 scales_1.2.1 pillar_1.8.1
[13] rlang_1.0.6 cli_3.6.0 curl_4.3.3 remotes_2.4.2
[17] generics_0.1.3 vctrs_0.5.1 tools_4.2.0 glue_1.6.2
[21] munsell_0.5.0 compiler_4.2.0 pkgconfig_2.0.3 colorspace_2.0-3
[25] tidyselect_1.2.0 tibble_3.1.8
Hmmm interesting... might be due to a bug in the graphics device or the graphics device not supporting blend modes. What graphics device are you using? You could check what the current device is:
.Device
And what its capabilities are:
dev.capabilities()
The compositing
element especially should tell you if blending is supported.
Thanks for the fast reply! Got tight up with other things just got to test this a bit more
In short so far what seem to works for me is to use png
device
To add a bit more context for my setup
I am using VSCode
, and mainly uses the httpgd
as they suggested
I initially tested on a linux server that only has terminal interphase which I thought might had been the issue
but then I used my own laptop (macOS Monterey) with same VSCode + httpgd
setup still the same result
On both device when I use .Device
it defaults to null device
and also on both machine, when I type dev.capabilities()
it crushes.
Activate a device first doesn't seem to help
> .Device
[1] "null device"
> dev.new()
> .Device
[1] "httpgd"
> dev.capabilities()
*** caught segfault ***
address 0x0, cause 'memory not mapped'
Traceback:
1: dev.capabilities()
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
However on Rstudio on my local machine running macOS, dev.capabilities()
works fine.
Perhaps httpgd
not the best device to support this? VScode
related? Not perfectly sure
pdf
device output weird plot with many dots missing. png
works
For now, might just need to use png
device when using VScode + httpgd
just need to be careful not to make plot without first activate the png device otherwise it crushes
Hmm yeah, sounds like probably an httpgd issue. You might report the dev.capabilities()
crash there and see what they say.
Re: pdf output, I find the cairo_pdf
device often works better: https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/cairo.html
Closing this since I think the root problem is elsewhere?