Skip to content

Incompatibility with latest versions of gdal #343

@corentincarton

Description

@corentincarton

Hi,

I'm working on a python environment in which I'm using pcraster and gdal and I get a segmentation fault when running the following:
python3 -c 'import pcraster; from osgeo import osr; srs = osr.SpatialReference(); srs.ImportFromEPSG(4326)'
Note that this doesn't happen when the imports are swapped (first gdal).

We had the bug on our HPC using a module system with python 3.8, gdal 3.2.1 and pcraster 4.3.0 but we could also reproduce it using a conda environment with the latest packages (python 3.9, gdal 3.3.3 and pcraster 4.3.2). Note that we don't have the bug when using python 3.6, gdal 3.0.4 and pcraster 4.3.0. So it seems to be an incompatibility between pcraster and the newer versions of gdal ?

Looking at the trace, it seems to be a consequence of the cleaning function deregisterGDALDrivers:
Program received signal SIGSEGV, Segmentation fault. 0x00002aaaae7c8c2f in OSRProjTLSCache::GetPJForEPSGCode(int, bool, bool) () from /usr/local/apps/gdal/3.2.1/lib/libgdal.so.28 (gdb) where #0 0x00002aaaae7c8c2f in OSRProjTLSCache::GetPJForEPSGCode(int, bool, bool) () from /usr/local/apps/gdal/3.2.1/lib/libgdal.so.28 #1 0x00002aaaae832947 in OGRSpatialReference::importFromEPSGA(int) () from /usr/local/apps/gdal/3.2.1/lib/libgdal.so.28 #2 0x00002aaaae841529 in OGRSpatialReference::importFromURNPart(char const*, char const*, char const*) () from /usr/local/apps/gdal/3.2.1/lib/libgdal.so.28 #3 0x00002aaaae84169d in OGRSpatialReference::importFromCRSURL(char const*) () from /usr/local/apps/gdal/3.2.1/lib/libgdal.so.28 #4 0x00002aaaae8424e4 in OGRSpatialReference::SetFromUserInput(char const*) () from /usr/local/apps/gdal/3.2.1/lib/libgdal.so.28 #5 0x00002aaaaefd2c2e in gdal::TileMatrixSet::parse(char const*) () from /usr/local/apps/gdal/3.2.1/lib/libgdal.so.28 #6 0x00002aaaaea37ae6 in GDALCOGDriver::InitializeCreationOptionList() () from /usr/local/apps/gdal/3.2.1/lib/libgdal.so.28 #7 0x00002aaaaea3cfe1 in GDALCOGDriver::GetMetadata(char const*) () from /usr/local/apps/gdal/3.2.1/lib/libgdal.so.28 #8 0x00002aaaad591bfc in dal::detail::rasterDrivers() () from /usr/local/apps/pcraster/4.3.0-01/lib/libpcraster_dal.so.4.3.0 #9 0x00002aaaad591e40 in dal::GDALRasterDriver::deregisterGDALDrivers() () from /usr/local/apps/pcraster/4.3.0-01/lib/libpcraster_dal.so.4.3.0 #10 0x00002aaaad538f0d in dal::Client::~Client() () from /usr/local/apps/pcraster/4.3.0-01/lib/libpcraster_dal.so.4.3.0 #11 0x00002aaaad12e100 in ClientHolder::~ClientHolder() () from /usr/local/apps/pcraster/4.3.0-01/lib/libpcraster_model_engine.so.4.3.0 #12 0x00002aaaab6c6655 in __run_exit_handlers () from /lib64/libc.so.6 #13 0x00002aaaab6c66a5 in exit () from /lib64/libc.so.6 #14 0x00002aaaab6afc3d in __libc_start_main () from /lib64/libc.so.6 #15 0x0000000000400881 in _start () at ../sysdeps/x86_64/elf/start.S:113

I can fix it by swapping the imports but in a complex environment it's not optimal.

I hope this helps, tell me if there's anything I can do. Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions