Skip to content

Segmentation fault when reading grib #435

@roughnemezis

Description

@roughnemezis

What happened?

Using xarray.open_dataset(path, engine="cfgrib") on my grib2 file, I get a segmentation fault.

I tried in a virtualenv, installing only xarray and cfgrib pip install xarray cfgrib, same result

Versions installed are:

> pip freeze | grep -E "cfgrib|xarray|eccodes"
cfgrib==0.9.15.1
eccodes==2.44.0
eccodeslib==2.44.0.5
xarray==2025.6.1

Manually downgrading eccodes pip install eccodes==2.38.1 solves the issue, my file is properly opened

I join a sample grib file

What are the steps to reproduce the bug?

In a fresh virtualenv:

pip install xarray cfgrib
import xarray
path = 'path/to/my/grib'
xarray.open_dataset(path, engine="cfgrib")

-> segmentation fault

pip install eccodes==2.38.1
import xarray
path = 'path/to/my/grib'
xarray.open_dataset(path, engine="cfgrib")

-> no seg fault

Version

0.9.15.1

Platform (OS and architecture)

Ubuntu 22.04.5 LTS x86_64

Relevant log output

Accompanying data

https://filesender.renater.fr/?s=download&token=a3ee63af-c99b-4ace-907c-eed4c5d2217f

Organisation

MeteoFrance

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions