terra
terra copied to clipboard
Segmentation Fault with terra::buffer(rast) in Docker Container
Hi First of all thanks a lot for the brilliant work on developing terra. it's a game changer in the field. I am using a simple docker image as below to run a script on an EC2 instance (The EC2 instance has sufficient memory and CPU resources) with ubuntu OS:
FROM rocker/geospatial
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
libssl-dev \
libudunits2-dev \
libgdal-dev \
gdal-bin \
libgeos-dev \
libproj-dev \
libsqlite3-dev \
&& apt-get clean
RUN R -e "install.packages(c('terra','raster','fasterize','wk','cleangeo','sf','snowflake', 'gdalUtilities'))"
using this image I will get:
> packageVersion("terra")
[1] ‘1.7.78’
> terra::gdal(lib="all")
gdal proj geos
"3.4.1" "8.2.1" "3.10.2"
now whenever I use the terra::buffer() on a raster layer in my script in the docker container, it returns a memory map error (it works fine on my local machine with the macOS 14.4 M1 Pro and
terra::gdal(lib="all") gdal proj geos "3.5.3" "9.1.0" "3.11.0" packageVersion("terra") [1] ‘1.7.78’) :
# Error Message: When running the following code in the Docker container:
terra::buffer(tile_raster_new, width = 250)
*** caught segfault ***
address 0x8, cause 'memory not mapped'
Traceback:
1: .External(list(name = "CppMethod__invoke_notvoid", address = <pointer: 0x5c959f1177f0>, dll = list(name = "Rcpp", path = "/usr/local/lib/R/site-library/Rcpp/libs/Rcpp.so", dynamicLookup = TRUE, handle = <pointer: 0x5c95a20a04c0>, info = <pointer: 0x5c959f903bb0>, forceSymbols = FALSE), numParameters = -1L), <pointer: 0x5c95a36c5c40>, <pointer: 0x5c95a3b18090>, .pointer, ...)
2: x@ptr$buffer(width, background, opt)
3: .local(x, ...)
4: terra::buffer(tile_raster_new, width = 250)
Could you please provide any insights or suggestions on how to resolve this issue?
Thank you!