Bug report #2840

adding an empty spatialite db causes qgis to crash

Added by Giovanni Manghi about 11 years ago. Updated about 11 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Data Provider
Affected QGIS version: Regression?:No
Operating System:Debian Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:12900

Description

Steps:

create an empty SL db trough qgis, then try to add it trough "add vector layer" or "add raster layer", it will cause qgis to crash.

Adding it trough "add spatialite layer" does not cause qgis to crash.

tested under ubuntu 10.04 and qgis trunk.

Error: 
    GDAL Error 4: @/home/gio/Desktop/db.sqlite' not recognised as a supported file format.

*** longjmp causes uninitialized stack frame ***: /usr/bin/qgis.bin terminated

h7. Backtrace:

/lib/tls/i686/cmov/libc.so.6(+fortify_fail+0x50)[0x8677390]
/lib/tls/i686/cmov/libc.so.6(+0xe22fa)[0x86772fa]
/usr/lib/R/lib/libR.so(+0xb46f9)[0xb53f96f9]
/usr/lib/R/lib/libR.so(+0xb2e7a)[0xb53f7e7a]
/usr/lib/R/lib/libR.so(Rf_errorcall+0x41b)[0xb53f84fb]
/usr/lib/R/lib/libR.so(Rf_error+0xb0)[0xb53f89d0]
/home/gio/R/i486-pc-linux-gnu-library/2.10/rgdal/libs/rgdal.so(+0x6ac4)[0x900bac4]
/usr/lib/libgdal1.7.0.so.1(CPLErrorV+0x219)[0x736aa99]
/usr/lib/libgdal1.7.0.so.1(CPLError+0x32)[0x736ab32]
/usr/lib/libgdal1.7.0.so.1(GDALOpen+0xd5)[0x7340255]
/usr/lib/libqgis_core.so.1.5.0(_ZN14QgsRasterLayer21isValidRasterFileNameERK7QStringRS0_+0x52)[0x676592]
/usr/bin/qgis.bin(_ZN7QgisApp15addRasterLayersERK11QStringListb+0xe2)[0x81282b2]
/usr/bin/qgis.bin(_ZN7QgisApp14addRasterLayerEv+0x100)[0x81288b0]
/usr/bin/qgis.bin(_ZN7QgisApp11qt_metacallEN11QMetaObject4CallEiPPv+0x3bd)[0x83601fd]
/usr/lib/libQtCore.so.4(_ZN11QMetaObject8metacallEP7QObjectNS_4CallEiPPv+0x3a)[0xc55c9a]
/usr/lib/libQtCore.so.4(_ZN11QMetaObject8activateEP7QObjectPKS_iPPv+0x2d5)[0xc643d5]
/usr/lib/libQtGui.so.4(_ZN7QAction9triggeredEb+0x49)[0x10c8bd9]
/usr/lib/libQtGui.so.4(_ZN7QAction8activateENS_11ActionEventE+0x7c)[0x10cadcc]
/usr/lib/libQtGui.so.4(_ZN11QToolButton14nextCheckStateEv+0x32)[0x15bdbd2]
/usr/lib/libQtGui.so.4(+0x540cb3)[0x14dacb3]
/usr/lib/libQtGui.so.4(_ZN15QAbstractButton17mouseReleaseEventEP11QMouseEvent+0x9e)[0x14dafae]
/usr/lib/libQtGui.so.4(_ZN11QToolButton17mouseReleaseEventEP11QMouseEvent+0x2c)[0x15be09c]
/usr/lib/libQtGui.so.4(_ZN7QWidget5eventEP6QEvent+0x528)[0x112d7f8]
/usr/lib/libQtGui.so.4(_ZN15QAbstractButton5eventEP6QEvent+0x3e)[0x14d9d4e]
/usr/lib/libQtGui.so.4(_ZN11QToolButton5eventEP6QEvent+0x4a)[0x15c0bca]
/usr/lib/libQtGui.so.4(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0xac)[0x10cf4dc]
/usr/lib/libQtGui.so.4(_ZN12QApplication6notifyEP7QObjectP6QEvent+0xb17)[0x10d69f7]
/usr/lib/libqgis_core.so.1.5.0(_ZN14QgsApplication6notifyEP7QObjectP6QEvent+0x33)[0x55c793]
/usr/lib/libQtCore.so.4(_ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent+0x7b)[0xc50a3b]
/usr/lib/libQtGui.so.4(_ZN19QApplicationPrivate14sendMouseEventEP7QWidgetP11QMouseEventS1_S1_PS1_R8QPointerIS0_Eb+0xf2)[0x10d5952]
/usr/lib/libQtGui.so.4(+0x1c7088)[0x1161088]
/usr/lib/libQtGui.so.4(_ZN12QApplication15x11ProcessEventEP7_XEvent+0x1771)[0x1160511]
/usr/lib/libQtGui.so.4(+0x1f560a)[0x118f60a]
/lib/libglib-2.0.so.0(g_main_context_dispatch+0x1d5)[0x60e65e5]
/lib/libglib-2.0.so.0(+0x3f2d8)[0x60ea2d8]
/lib/libglib-2.0.so.0(g_main_context_iteration+0x68)[0x60ea4b8]
/usr/lib/libQtCore.so.4(_ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x65)[0xc7c5d5]
/usr/lib/libQtGui.so.4(+0x1f5135)[0x118f135]
/usr/lib/libQtCore.so.4(_ZN10QEventLoop13processEventsE6QFlagsINS_17ProcessEventsFlagEE+0x49)[0xc4f059]
/usr/lib/libQtCore.so.4(_ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE+0xfa)[0xc4f4aa]
/usr/lib/libQtCore.so.4(_ZN16QCoreApplication4execEv+0xaf)[0xc5369f]
/usr/lib/libQtGui.so.4(_ZN12QApplication4execEv+0x27)[0x10cf577]
/usr/bin/qgis.bin(main+0x1b70)[0x80f9910]
/lib/tls/i686/cmov/libc.so.6(+libc_start_main+0xe6)[0x85abbd6]
/usr/bin/qgis.bin[0x80f75f1]

h7. Memory map:

00110000-002b1000 r-xp 00000000 08:01 140960     /usr/lib/libqgis_gui.so.1.5.0
002b1000-002b7000 r--p 001a0000 08:01 140960     /usr/lib/libqgis_gui.so.1.5.0
002b7000-002b9000 rw-p 001a6000 08:01 140960     /usr/lib/libqgis_gui.so.1.5.0
002b9000-002fb000 r-xp 00000000 08:01 141016     /usr/lib/libQtXml.so.4.6.2
002fb000-002fc000 ---p 00042000 08:01 141016     /usr/lib/libQtXml.so.4.6.2
002fc000-002fd000 r--p 00042000 08:01 141016     /usr/lib/libQtXml.so.4.6.2
002fd000-002fe000 rw-p 00043000 08:01 141016     /usr/lib/libQtXml.so.4.6.2
002fe000-00421000 r-xp 00000000 08:01 140981     /usr/lib/libQtNetwork.so.4.6.2
00421000-00424000 r--p 00122000 08:01 140981     /usr/lib/libQtNetwork.so.4.6.2
00424000-00425000 rw-p 00125000 08:01 140981     /usr/lib/libQtNetwork.so.4.6.2
00425000-00458000 r-xp 00000000 08:01 140573     /usr/lib/libproj.so.0.6.6
00458000-00459000 r--p 00032000 08:01 140573     /usr/lib/libproj.so.0.6.6
00459000-0045b000 rw-p 00033000 08:01 140573     /usr/lib/libproj.so.0.6.6
0045b000-0045d000 r-xp 00000000 08:01 261942     /lib/tls/i686/cmov/libdl-2.11.1.so
0045d000-0045e000 r--p 00001000 08:01 261942     /lib/tls/i686/cmov/libdl-2.11.1.so
0045e000-0045f000 rw-p 00002000 08:01 261942     /lib/tls/i686/cmov/libdl-2.11.1.so
0045f000-00461000 r-xp 00000000 08:01 261935     /lib/libcom_err.so.2.1
00461000-00462000 r--p 00001000 08:01 261935     /lib/libcom_err.so.2.1
00462000-00463000 rw-p 00002000 08:01 261935     /lib/libcom_err.so.2.1
00463000-00467000 r-xp 00000000 08:01 134992     /usr/lib/libgthread-2.0.so.0.2400.1
00467000-00468000 r--p 00003000 08:01 134992     /usr/lib/libgthread-2.0.so.0.2400.1
00468000-00469000 rw-p 00004000 08:01 134992     /usr/lib/libgthread-2.0.so.0.2400.1
00469000-0046a000 r-xp 00000000 08:01 441506     /usr/lib/grass64/lib/libgrass_linkm.6.4.0RC6.so
0046a000-0046b000 r--p 00000000 08:01 441506     /usr/lib/grass64/lib/libgrass_linkm.6.4.0RC6.so
0046b000-0046c000 rw-p 00001000 08:01 441506     /usr/lib/grass64/lib/libgrass_linkm.6.4.0RC6.so
0046c000-00487000 r-xp 00000000 08:01 275772     /lib/ld-2.11.1.so
00487000-00488000 r--p 0001a000 08:01 275772     /lib/ld-2.11.1.so
00488000-00489000 rw-p 0001b000 08:01 275772     /lib/ld-2.11.1.so
00489000-0083d000 r-xp 00000000 08:01 168732     /usr/lib/libqgis_core.so.1.5.0
0083d000-00844000 r--p 003b3000 08:01 168732     /usr/lib/libqgis_core.so.1.5.0
00844000-00847000 rw-p 003ba000 08:01 168732     /usr/lib/libqgis_core.so.1.5.0
00847000-00848000 rw-p 00000000 00:00 0 
00848000-0089d000 r-xp 00000000 08:01 141009     /usr/lib/libQtSvg.so.4.6.2
0089d000-0089e000 ---p 00055000 08:01 141009     /usr/lib/libQtSvg.so.4.6.2
0089e000-0089f000 r--p 00055000 08:01 141009     /usr/lib/libQtSvg.so.4.6.2
0089f000-008a0000 rw-p 00056000 08:01 141009     /usr/lib/libQtSvg.so.4.6.2
008a0000-008ba000 r-xp 00000000 08:01 138328     /usr/lib/libgeos_c.so.1.6.2
008ba000-008bb000 r--p 00019000 08:01 138328     /usr/lib/libgeos_c.so.1.6.2
008bb000-008bc000 rw-p 0001a000 08:01 138328     /usr/lib/libgeos_c.so.1.6.2
008bc000-008d1000 r-xp 00000000 08:01 262036     /lib/tls/i686/cmov/libpthread-2.11.1.so
008d1000-008d2000 r--p 00014000 08:01 262036     /lib/tls/i686/cmov/libpthread-2.11.1.so
008d2000-008d3000 rw-p 00015000 08:01 262036     /lib/tls/i686/cmov/libpthread-2.11.1.so
008d3000-008d5000 rw-p 00000000 00:00 0 
008d5000-008e8000 r-xp 00000000 08:01 262077     /lib/libz.so.1.2.3.3
008e8000-008e9000 r--p 00012000 08:01 262077     /lib/libz.so.1.2.3.3
008e9000-008ea000 rw-p 00013000 08:01 262077     /lib/libz.so.1.2.3.3
008ea000-008f1000 r-xp 00000000 08:01 262042     /lib/tls/i686/cmov/librt-2.11.1.so
008f1000-008f2000 r--p 00006000 08:01 262042     /lib/tls/i686/cmov/librt-2.11.1.so
008f2000-008f3000 rw-p 00007000 08:01 262042     /lib/tls/i686/cmov/librt-2.11.1.so
008f3000-008f5000 r-xp 00000000 08:01 261975     /lib/libkeyutils-1.2.so
008f5000-008f6000 r--p 00001000 08:01 261975     /lib/libkeyutils-1.2.so
008f6000-008f7000 rw-p 00002000 08:01 261975     /lib/libkeyutils-1.2.so
008f7000-008f8000 r-xp 00000000 08:01 135412     /usr/lib/gtk-2.0/2.10.0/loaders/svg_loader.so
008f8000-008f9000 r--p 00000000 08:01 135412     /usr/lib/gtk-2.0/2.10.0/loaders/svg_loader.so
008f9000-008fa000 rw-p 00001000 08:01 135412     /usr/lib/gtk-2.0/2.10.0/loaders/svg_loader.so
008fa000-009b9000 r-xp 00000000 08:01 181217     /usr/lib/libqwt-qt4.so.5.2.0
009b9000-009bd000 r--p 000be000 08:01 181217     /usr/lib/libqwt-qt4.so.5.2.0
009bd000-009bf000 rw-p 000c2000 08:01 181217     /usr/lib/libqwt-qt4.so.5.2.0
009bf000-00aa8000 r-xp 00000000 08:01 137064     /usr/lib/libstdc++.so.6.0.13
00aa8000-00aa9000 ---p 000e9000 08:01 137064     /usr/lib/libstdc++.so.6.0.13
00aa9000-00aad000 r--p 000e9000 08:01 137064     /usr/lib/libstdc++.so.6.0.13
00aad000-00aae000 rw-p 000ed000 08:01 137064     /usr/lib/libstdc++.so.6.0.13
00aae000-00ab5000 rw-p 00000000 00:00 0 
00ab5000-00ae2000 r-xp 00000000 08:01 176440     /usr/lib/libgssapi_krb5.so.2.2
00ae2000-00ae3000 r--p 0002d000 08:01 176440     /usr/lib/libgssapi_krb5.so.2.2
00ae3000-00ae4000 rw-p 0002e000 08:01 176440     /usr/lib/libgssapi_krb5.so.2.2
00ae4000-00ae6000 r-xp 00000000 08:01 136159     /usr/lib/libXau.so.6.0.0
00ae6000-00ae7000 r--p 00001000 08:01 136159     /usr/lib/libXau.so.6.0.0
00ae7000-00ae8000 rw-p 00002000 08:01 136159     /usr/lib/libXau.so.6.0.0
00ae8000-00d5e000 r-xp 00000000 08:01 140966     /usr/lib/libQtCore.so.4.6.2
00d5e000-00d65000 r--p 00275000 08:01 140966     /usr/lib/libQtCore.so.4.6.2
00d65000-00d66000 rw-p 0027c000 08:01 140966     /usr/lib/libQtCore.so.4.6.2
00d66000-00d68000 r-xp 00000000 08:01 141546     /usr/lib/gconv/UTF-16.so
00d68000-00d69000 r--p 00001000 08:01 141546     /usr/lib/gconv/UTF-16.so
00d69000-00d6a000 rw-p 00002000 08:01 141546     /usr/lib/gconv/UTF-16.so
00d6a000-00d6b000 r-xp 00000000 00:00 0          [vdso]
00d6b000-00dad000 r-xp 00000000 08:01 262636     /lib/i686/cmov/libssl.so.0.9.8
00dad000-00dae000 r--p 00042000 08:01 262636     /lib/i686/cmov/libssl.so.0.9.8
00dae000-00db1000 rw-p 00043000 08:01 262636     /lib/i686/cmov/libssl.so.0.9.8
00db1000-00dba000 r-xp 00000000 08:01 261936     /lib/tls/i686/cmov/libcrypt-2.11.1.so
00dba000-00dbb000 r--p 00008000 08:01 261936     /lib/tls/i686/cmov/libcrypt-2.11.1.so
00dbb000-00dbc000 rw-p 00009000 08:01 261936     /lib/tls/i686/cmov/libcrypt-2.11.1.so
00dbc000-00de3000 rw-p 00000000 00:00 0 
00de3000-00e27000 r-xp 00000000 08:01 136787     /usr/lib/libldap_r-2.4.so.2.5.4
00e27000-00e28000 r--p 00043000 08:01 136787     /usr/lib/libldap_r-2.4.so.2.5.4Aborted

History

#1 Updated by Jürgen Fischer about 11 years ago

Are you using SDA4PP? Seems like that it intercepts GDAL errors, but crashes when one happens.

See also #2829 and probably also #2768.

#2 Updated by Giovanni Manghi about 11 years ago

I removed SDA4PP and the messages changes slightly, but sI still have a crash.

if using "add raster layer" I get

"/home/gio/Desktop/teste is not a supported raster data source"

I believe that this should appear more like "empty db"

if using "add vector layer" qgis crashes with

ERROR 10: Pointer 'hLayer' is NULL in 'OGR_L_GetExtent'.

ERROR 10: Pointer 'hLayer' is NULL in 'OGR_L_GetSpatialRef'.

ERROR 10: Pointer 'hLayer' is NULL in 'OGR_L_GetLayerDefn'.

Fatal: ASSERT failure in QList<T>::at: "index out of range", file /usr/include/qt4/QtCore/qlist.h, line 439
Aborted

#3 Updated by Jürgen Fischer about 11 years ago

We don't have support for rasterlite. So it's an unsupported datasource.

When I try to add spatialite layers using OGR (ie. "Add Vector Layers...") I get:
- on a completely empty sqlite database: "empty.db is not a valid or recognized datasource".
- on a fresh spatialite database without any layers: a sublayer list with geom_ref_sys, geometry_columns and spatial_ref_sys. and selecting a table produces a mostly useless layer,
- on a spatialite database with layers: adding a "valid" layer also produces a useless layer.

Why are you trying to you OGR instead of the spatialite provider?

Anyway still no crash. Are you sure that you don't have any other misbehaving plugins? What about a backtrace?

#4 Updated by Giovanni Manghi about 11 years ago

Hi,

Replying to [comment:3 jef]:

We don't have support for rasterlite. So it's an unsupported datasource.

well, gdal 1.7 supports it, so I was just playing around. In any case if you try open a rasterlite db trough "add raster layer" it works fine... since the db has just one raster map, see #1040

When I try to add spatialite layers using OGR (ie. "Add Vector Layers...") I get:
- on a completely empty sqlite database: "empty.db is not a valid or recognized datasource".
- on a fresh spatialite database without any layers: a sublayer list with geom_ref_sys, geometry_columns and spatial_ref_sys. and selecting a table produces a mostly useless layer,

In these two cases here I'm getting the crash, see the above message.

- on a spatialite database with layers: adding a "valid" layer also produces a useless layer.

If the SL db has at least one layer in it, it works fine for me. If it has more than one qgis correctly present the window to let choose what layers to load, and it all shows fine in the qgis canvas. I used the SL sample dataset.

Why are you trying to you OGR instead of the spatialite provider?

for no reason in particular, as is valid ogr datasource I was testing qgis behavior.

Anyway still no crash. Are you sure that you don't have any other misbehaving plugins? What about a backtrace?

I removed all the plugins (removed the entire .qgis directory) and I still see the crash when opening empty SL or sqlite dbs.

If you please help me on how obtain the backtrace I will post it back right after.

cheers

#5 Updated by Jürgen Fischer about 11 years ago

Replying to [comment:4 lutra]:

Replying to [comment:3 jef]:

We don't have support for rasterlite. So it's an unsupported datasource.

well, gdal 1.7 supports it, so I was just playing around. In any case if you
try open a rasterlite db trough "add raster layer" it works fine... since the
db has just one raster map, see #1040

Ok. With GDAL 1.7 from experimental I can add the the layer. Is there a
sample set with multiple rasters?

When I try to add spatialite layers using OGR (ie. "Add Vector Layers...") I get:
- on a completely empty sqlite database: "empty.db is not a valid or recognized datasource".
- on a fresh spatialite database without any layers: a sublayer list with geom_ref_sys, geometry_columns and spatial_ref_sys. and selecting a table produces a mostly useless layer,

In these two cases here I'm getting the crash, see the above message.

Still no crash on the first case, but on the second with GDAL 1.7. Fixed in
0c1a9612 (SVN r13818).

- on a spatialite database with layers: adding a "valid" layer also produces a useless layer.

If the SL db has at least one layer in it, it works fine for me. If it has
more than one qgis correctly present the window to let choose what layers to
load, and it all shows fine in the qgis canvas. I used the SL sample dataset.

Works fine with GDAL 1.7 for me now, too.

Anyway still no crash. Are you sure that you don't have any other misbehaving plugins? What about a backtrace?

I removed all the plugins (removed the entire .qgis directory) and I still
see the crash when opening empty SL or sqlite dbs. If you please help me on
how obtain the backtrace I will post it back right after.

I added instructions to UsingTracWithQuantumGis

#6 Updated by Giovanni Manghi about 11 years ago

Ok. With GDAL 1.7 from experimental I can add the the layer. Is there a
sample set with multiple rasters?

I prepared one here

http://www.faunalia.pt/downloads/db.sqlite.tar.gz

The message that shows is

/home/gio/Desktop/db.sqlite is not a supported raster data source
This raster file has no bands and is invalid as a raster layer.

Still no crash on the first case, but on the second with GDAL 1.7. Fixed in
0c1a9612 (SVN r13818).

forget about the first case, I was probably testing a sqlite db not well formed, I tested again and is ok.

I added instructions to UsingTracWithQuantumGis

thanks!

#7 Updated by Jürgen Fischer about 11 years ago

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

Replying to [comment:6 lutra]:

Ok. With GDAL 1.7 from experimental I can add the the layer. Is there a
sample set with multiple rasters?

I prepared one here

http://www.faunalia.pt/downloads/db.sqlite.tar.gz

Thanks. I meanwhile found planet_earth.sqlite and use it to come up with a patch for #1040.

But I take it this doesn't crash anymore anyway. So I'm closing the ticket.

Also available in: Atom PDF