[gdal-dev] GDAL Seg Fault - for info
Paul Harwood
runette at gmail.com
Mon Nov 21 03:40:30 PST 2022
This may not be a GDAL bug and as such I have not raised it as an issue but
I wanted to put it here for anyone else who comes across the same problem.
There does appear to be some interference between, at least the conda
distribution of, GDAL and something else within Python causing a
segmentation fault.
----------------------------------------
SYMPTOMS
I have a Python application that uses GDAL (and PDAL Python and MDAL Python
and PyProj) wrapped in Kivy - so it is relatively complicated.
I was just clearing tech debt / updating etc. GDAL to 3.6 but also the
other apps to latest versions (including kivy).
BEFORE - if I tried to open an unrecognised file in GDAL I got an Exception
(using UseExceptions() ). This is related to Python Duck Typing
AFTER - I get a seg fault and no debug info.
This happened in exactly the same way on two machines - one Mac and one
Windows - so I don't think it is a bad config. Attempts to create a
minimum example do not work - suggesting that it is a complicated
interaction between the various components
I am using conda as the environment manager.
------------------------------------------
ULTIMATE(-ish) SOLUTION
After getting some diagnostic data and some experimentation, it turned out
that the fault is coming in the error handling. I managed to avoid the
segmentation fault by creating and registering a dedicated error handler
for GDAL.
--------------------------------------------
DEEPER DISCUSSION
I found some discussion from a couple of years ago about a problem that
sounds similar (see https://github.com/conda-forge/gdal-feedstock/issues/365)
- it was not solved but was not very reproducible so was closed.
This suggests an interference between requests and gdal - depending on the
order in which they are imported. Certainly - kivy (or more precisely
kivyMD) is using requests but I was not able to solve the problem by
changing import orders (kivy has a lot of asynch and event based things
happening and the app is very modular so it is not that simple).
However - if the interference is in the error handler - then that would
explain why it was difficult to reproduce (need to hit the right exception
in the right way).
Not sure if we can fix this one - but if anyone else does come across a
similar problem I would suggest to try and create a custom error handler to
see if the problem is there.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221121/87e0af6c/attachment.htm>
More information about the gdal-dev
mailing list