cogeotiff / rio-tiler

User friendly Rasterio plugin to read raster datasets.
https://cogeotiff.github.io/rio-tiler/
BSD 3-Clause "New" or "Revised" License
517 stars 108 forks source link

Ensure that `dataset` is still open when reading `tags` #628

Closed JackDunnNZ closed 1 year ago

JackDunnNZ commented 1 year ago

Previously this statement was outside the ctx context, and so dataset may already have been freed before we call dataset.tags(). In my experience, this was sporadically leading to either of the following errors:

rasterio.errors.RasterioIOError: Dataset is closed`

or

rasterio._err.ObjectNullError: Pointer 'hObject' is NULL in 'GDALGetMetadata'.

The corresponding statement for the read method was already inside the ctx context, so this was only a problem for the point method.

vincentsarago commented 1 year ago

good catch 🙏

vincentsarago commented 1 year ago

@JackDunnNZ I'm going to merge this and make a new release today 🙏

JackDunnNZ commented 1 year ago

Thanks!