I'm running R code in a .qmd
file using VS Code and plot results using r.plot.useHttpgd
. In various cases I get an *** caught segfault ***
error.
Reproducible example
library(spatstat)
plot(amacrine) # This works fine
plot(unmark(amacrine)) # It crashes here
I get the following error message:
*** caught segfault ***
address 0x0, cause 'invalid permissions'
Traceback:
1: dev.capabilities()
2: default.symap.points(unmark(x), ..., chars = chars, cols = cols)
3: plot.ppp(unmark(amacrine))
4: plot(unmark(amacrine))
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
When I run it without httpgd
(i. e. a .png
output) the code runs fine. It also works when I use RStudio.
Could it be a problem with VSCode?
> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.6.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] spatstat_3.0-6 spatstat.linnet_3.1-1 spatstat.model_3.2-4
[4] rpart_4.1.19 spatstat.explore_3.2-1 nlme_3.1-160
[7] spatstat.random_3.1-5 spatstat.geom_3.2-1 spatstat.data_3.0-1
loaded via a namespace (and not attached):
[1] lattice_0.20-45 deldir_1.0-9 grid_4.2.2
[4] jsonlite_1.8.7 tensor_1.5 rlang_1.1.1
[7] cli_3.6.1 goftest_1.2-3 Matrix_1.5-4.1
[10] spatstat.utils_3.0-3 splines_4.2.2 polyclip_1.10-4
[13] abind_1.4-5 compiler_4.2.2 spatstat.sparse_3.0-2
[16] mgcv_1.8-41
The issue is fixed in the development version of httpgd
which can be installed via remotes::install_github("nx10/httpgd")
.
GitHub issue describing a similar problem: https://github.com/nx10/httpgd/issues/122