pygrib icon indicating copy to clipboard operation
pygrib copied to clipboard

Segfault on Python 3.12

Open torfsen opened this issue 1 year ago • 0 comments

I get a segfault on Python 3.12.5 with pygrib 2.1.6 while trying to close an ECMWF ensemble GRIB file that was opened via pygrib.index:

$ cat segfault.py 
#!/usr/bin/env python

import pygrib
import sys

idx = None
try:
    print("Loading ...")
    idx = pygrib.index(sys.argv[1])
    print("Loaded.")
except Exception as e:
    print(f"ERROR: {e}")
finally:
    if idx is not None:
        print("Closing ...")
        idx.close()
    print("Closed.")

$ PYTHONFAULTHANDLER=1 python segfault.py ecmwf_ens_euro-0.25_2024121000_f000.grib2
Loading ...
Loaded.
Closing ...
Fatal Python error: Segmentation fault

Current thread 0x00007f828968b740 (most recent call first):
  File "/home/fbrucker/ubide-physicalforecast/segfault.py", line 16 in <module>

Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, pyproj._compat, pyproj._context, pyproj._network, pyproj._version, pyproj._geod, pyproj.list, pyproj._crs, pyproj.database, pyproj._transformer, pyproj._sync, pygrib._pygrib (total: 24)
Segmentation fault (core dumped)

I have eccodes=2.39.0 and I'm running Ubuntu 20.04.

torfsen avatar Dec 10 '24 12:12 torfsen