Bug report #21162

Closing a netcdf raster in Windows causes core dump

Added by Saber Razmjooei over 1 year ago. Updated over 1 year ago.

Status:Closed
Priority:High
Assignee:Jürgen Fischer
Category:Data Provider
Affected QGIS version:3.5(master) Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:28980

Description

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

NetCDF_QGIS_Master.gif (2.39 MB) Pedro Venâncio, 2019-02-06 11:21 AM

NetCDF_context_menu.jpg (181 KB) Pedro Venâncio, 2019-02-06 11:21 AM

History

#1 Updated by Jürgen Fischer over 1 year ago

gdalinfo also crashes.

#2 Updated by Saber Razmjooei over 1 year ago

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.

#3 Updated by Saber Razmjooei over 1 year ago

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

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

#4 Updated by Pedro Venâncio over 1 year ago

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.

#5 Updated by Jürgen Fischer over 1 year ago

  • Assignee set to Jürgen Fischer

#6 Updated by Alexandre Neto over 1 year ago

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.

#7 Updated by Alexandre Neto over 1 year ago

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

#8 Updated by Jürgen Fischer over 1 year ago

  • Status changed from Open to Closed
  • Resolution set to fixed/implemented

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

#9 Updated by Saber Razmjooei over 1 year ago

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?

#10 Updated by Jürgen Fischer over 1 year ago

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.

#11 Updated by Saber Razmjooei over 1 year ago

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

Thanks a lot for the prompt upgrade of the libraries!

#12 Updated by Pedro Venâncio over 1 year ago

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:

  • Loading as Mesh:
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.
  • Loading as Raster:
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.

#13 Updated by Saber Razmjooei over 1 year ago

@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.

#14 Updated by Pedro Venâncio over 1 year ago

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.

#15 Updated by Saber Razmjooei over 1 year ago

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.

#16 Updated by Jürgen Fischer over 1 year ago

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).

#17 Updated by Pedro Venâncio over 1 year ago

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!

Also available in: Atom PDF