qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.52k stars 2.99k forks source link

Closing a netcdf raster in Windows causes core dump #28980

Closed qgib closed 5 years ago

qgib commented 5 years ago

Author Name: Saber Razmjooei (@saberraz) Original Redmine Issue: 21162 Affected QGIS version: 3.5(master) Redmine category:data_provider Assignee: Jürgen Fischer


To reproduce: 1- Download http://mf2.ipma.pt/downloads/?latest=arome.2m.relative_humidity&region=PT2 2- Add the netcdf as raster 3- Right-click and remove the raster in layers panel 4- Boom

This is a Windows only issue and might be related to netcdf driver. See also: https://github.com/lutraconsulting/MDAL/issues/90


qgib commented 5 years ago

Author Name: Jürgen Fischer (@jef-n)


gdalinfo also crashes.

qgib commented 5 years ago

Author Name: Saber Razmjooei (@saberraz)


It is confirmed that custom QGIS builds with netcdf 4.6.x in Windows do not crash. So, I am pretty sure it is due to old netcdf driver.

qgib commented 5 years ago

Author Name: Saber Razmjooei (@saberraz)


It is the same issue as: https://trac.osgeo.org/osgeo4w/ticket/551

Update to the newer versions of netcdf should resolve the problem.

qgib commented 5 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Downgrading netcdf driver to 4.3.0-1, also available in OSGeo4W, is not an option here, because this NetCDF files are not correctly recognized as Raster (min and max value always 1.79769e+308) with this version.

Loading them as Mesh gives

Invalid Data Source: D:\AROME_OPER_001_FC_SP_PT2_025_RH_2-HTGL_2019020412.nc is not a valid or recognized data source.
qgib commented 5 years ago

Author Name: Jürgen Fischer (@jef-n)


qgib commented 5 years ago

Author Name: Alexandre Neto (@SrNetoChan)


I am getting a CRASH even before loading the data. Simply using the browser panel to navigate to it, as soon as I reach a folder with one of those files, QGIS crashes.

qgib commented 5 years ago

Author Name: Alexandre Neto (@SrNetoChan)


This is the crash report I get:

Crash ID: be28959efc88f41008b90f2715e269b9959ca36c

Stack Trace

RtlFreeHeap : free_base : nc_set_var_chunk_cache_ints : nc_set_var_chunk_cache_ints : NC4_sync : NC4_close : nc_close : GDALRegister_netCDF : GDALRegister_netCDF : QgsLayoutUtils::fontHeightCharacterMM : OGREnvelope::IsInit : OGREnvelope::IsInit : QgsLayoutUtils::fontHeightCharacterMM : QgsLayoutUtils::fontHeightCharacterMM : QgsLayoutUtils::fontHeightCharacterMM : QgsLayoutUtils::fontHeightCharacterMM : QThreadPoolPrivate::reset : QThread::start : BaseThreadInitThunk : RtlUserThreadStart :

QGIS Info QGIS Version: 3.5.0-Master QGIS code revision: 4a44306700 Compiled against Qt: 5.11.2 Running against Qt: 5.11.2 Compiled against GDAL: 2.4.0 Running against GDAL: 2.4.0

System Info CPU Type: x86_64 Kernel Type: winnt Kernel Version: 10.0.17763

qgib commented 5 years ago

Author Name: Jürgen Fischer (@jef-n)


rebuilt / updated szip, hdf4, hdf5 and netcdf in OSGeo4W using VC14.


qgib commented 5 years ago

Author Name: Saber Razmjooei (@saberraz)


Thanks jef for the update.

Now, I can open the netcdf in QGIS 3.4 but in master it fails to open altogether. @pedro @alexandre could you confirm?

qgib commented 5 years ago

Author Name: Jürgen Fischer (@jef-n)


Saber Razmjooei wrote:

Thanks jef for the update.

Now, I can open the netcdf in QGIS 3.4 but in master it fails to open altogether. @pedro @alexandre could you confirm?

works fine in the nightly (64bit) of 185855b214 for me.

qgib commented 5 years ago

Author Name: Saber Razmjooei (@saberraz)


Brilliant, I did a re-install and all works well.

Thanks a lot for the prompt upgrade of the libraries!

qgib commented 5 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Jürgen Fischer wrote:

Saber Razmjooei wrote:

Thanks jef for the update.

Now, I can open the netcdf in QGIS 3.4 but in master it fails to open altogether. @pedro @alexandre could you confirm?

works fine in the nightly (64bit) of 185855b214 for me.

Hi Jurgen,

I'm also with problems in master (code revision 185855b214).

Now I don't have any crash in browser when opening the folder with these NetCDF files, but when I try to load them in QGIS, I get:

2019-02-06T09:26:19     CRITICAL    Layer is not valid : The layer is not a valid layer and can not be added to the map

2019-02-06T09:29:53     CRITICAL    Invalid Data Source : C:\Users\pedro.venancio\Documents\Nova_pasta_2\AROME_OPER_001_FC_SP_PT2_025_RH_2-HTGL_2019020512.nc is not a valid or recognized data source.
2019-02-06T09:27:06     CRITICAL    Invalid Layer : GDAL provider Cannot open GDAL dataset C:/Users/pedro.venancio/Documents/Nova_pasta_2/AROME_OPER_001_FC_SP_PT2_025_RH_2-HTGL_2019020512.nc:
             `C:/Users/pedro.venancio/Documents/Nova_pasta_2/AROME_OPER_001_FC_SP_PT2_025_RH_2-HTGL_2019020512.nc' not recognized as a supported file format. (file: ..\..\..\src\providers\gdal\qgsgdalprovider.cpp row: 2616function QgsGdalProvider::initIfNeeded:)
             Raster layer Provider is not valid (provider: gdal, URI: C:/Users/pedro.venancio/Documents/Nova_pasta_2/AROME_OPER_001_FC_SP_PT2_025_RH_2-HTGL_2019020512.nc (file: ..\..\..\src\core\raster\qgsrasterlayer.cpp row: 616function QgsRasterLayer::setDataProvider:)

With QGIS 3.4.4 everything works fine.

qgib commented 5 years ago

Author Name: Saber Razmjooei (@saberraz)


@Pedro,

I had the same issue. But I re-ran OSGeo4W installer and marked gdal and qgis-dev to be re-installed. It worked after re-installation.

qgib commented 5 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Hi Saber,

I re-installed qgis-dev, gdal and netcdf, but I get the same behaviour in master.

This is even more strange.

In Browser, if I load the .nc file, first as Raster, and then as Mesh, everything works fine.

If I try to load the Mesh first, I get that error.

Please see the screencast attached.

The same happens loading .nc files from Data Source Manager (First as Raster, then as Mesh -> ok | First as Mesh -> Invalid Data Source: C:\Users\pedro.venancio\Documents\netcdf\AROME_OPER_001_FC_SP_PT2_025_TMP_2-HTGL_2019020600.nc is not a valid or recognized data source.).

The context menu is also different in both versions.



qgib commented 5 years ago

Author Name: Saber Razmjooei (@saberraz)


I can confirm the issue. I think it is a browser problem with handling the file formats. Everything works as expected from Add Source Layer option.

Let me try it in the latest Linux build and we can open a new ticket.

qgib commented 5 years ago

Author Name: Jürgen Fischer (@jef-n)


Saber Razmjooei wrote:

I can confirm the issue. I think it is a browser problem with handling the file formats. Everything works as expected from Add Source Layer option.

Let me try it in the latest Linux build and we can open a new ticket.

Wait for the next nightly build - the current might still be built with the previous HDF5 (so the MDAL provider might still have issues, that GDAL doesn't have anymore).

qgib commented 5 years ago

Author Name: Pedro Venâncio (Pedro Venâncio)


Jürgen Fischer wrote:

Wait for the next nightly build - the current might still be built with the previous HDF5 (so the MDAL provider might still have issues, that GDAL doesn't have anymore).

Seems fixed now Jürgen!

Thank you very much!