Bug report #10127

Randomly crash after a while

Added by Luigi Pirelli over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:High
Assignee:Martin Dobias
Category:-
Affected QGIS version:master Regression?:No
Operating System:debian Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:18587

Description

Hi I'm experiencing randomly crashes so I decided to start qgis with gdb to trace the error

I'm on a udpated debian wheezy 64bit with compiled qgis 60dc15e

this is the trace of the abort... seems related to multithread rendering
I've some spatialite layers and spatialite3 with internal provider compilation, but I've also a spatialite debian package installed

let me know if you need more infos

Fatal: ASSERT: "it != mGroups.end()" in file /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/../../core/qgsconnectionpool.h, line 226
QGIS died on signal -1ptrace: Operation not permitted.
No thread selected
No stack.
gdb returned 0

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff76ffd700 (LWP 11650)]
0x00007ffff0493475 in _GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
#0 0x00007ffff0493475 in *
_GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007ffff04966f0 in *__GI_abort () at abort.c:92
#2 0x000000000058a46b in qgisCrash (signal=-1) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/app/main.cpp:303
#3 0x000000000058a642 in myMessageOutput (type=QtFatalMsg, msg=
0x7fff78072698 "ASSERT: \\"it != mGroups.end()\\" in file /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/../../core/qgsconnectionpool.h, line 226")
at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/app/main.cpp:356
#4 0x00007ffff3375630 in qt_message_output(QtMsgType, char const
) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5 0x00007ffff3375a98 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6 0x00007ffff3375c24 in qFatal(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7 0x00007fff8ad42b5b in QgsConnectionPool<QgsSqliteHandle*, QgsSpatiaLiteConnPoolGroup>::releaseConnection (this=0x7fff70050960, conn=0x7fff7806d2b0)
at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/../../core/qgsconnectionpool.h:226
#8 0x00007fff8ad3e6bd in QgsSpatiaLiteFeatureIterator::close (this=0x7fff780042d0) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/qgsspatialitefeatureiterator.cpp:127
#9 0x00007fff8ad3e5ba in QgsSpatiaLiteFeatureIterator::fetchFeature (this=0x7fff780042d0, feature=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/qgsspatialitefeatureiterator.cpp:90
#10 0x00007ffff4a0d6aa in QgsAbstractFeatureIterator::nextFeature (this=0x7fff780042d0, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsfeatureiterator.cpp:51
#11 0x000000000062680c in QgsFeatureIterator::nextFeature (this=0x7fff78004100, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/app/../core/qgsfeatureiterator.h:196
#12 0x00007ffff4b6bba1 in QgsVectorLayerFeatureIterator::fetchFeature (this=0x7fff78004000, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsvectorlayerfeatureiterator.cpp:199
#13 0x00007ffff4a0d6aa in QgsAbstractFeatureIterator::nextFeature (this=0x7fff78004000, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsfeatureiterator.cpp:51
#14 0x000000000062680c in QgsFeatureIterator::nextFeature (this=0x7fff76ffc950, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/app/../core/qgsfeatureiterator.h:196
#15 0x00007ffff48c2fef in QgsVectorLayerRenderer::drawRendererV2 (this=0x7106a50, fit=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsvectorlayerrenderer.cpp:214
#16 0x00007ffff48c27c9 in QgsVectorLayerRenderer::render (this=0x7106a50) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsvectorlayerrenderer.cpp:181
#17 0x00007ffff48bb4b1 in QgsMapRendererParallelJob::renderLayerStatic (job=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsmaprendererjob.cpp:890
#18 0x00007ffff48c0a60 in QtConcurrent::FunctionWrapper1<void, LayerRenderJob&>::operator() (this=0x7642a08, u=...) at /usr/include/qt4/QtCore/qtconcurrentfunctionwrappers.h:86
#19 0x00007ffff48c077e in QtConcurrent::MapKernel<QList<LayerRenderJob>::iterator, QtConcurrent::FunctionWrapper1<void, LayerRenderJob&> >::runIteration (this=0x76429d0, it=...)
at /usr/include/qt4/QtCore/qtconcurrentmapkernel.h:73
#20 0x00007ffff48c0803 in QtConcurrent::MapKernel<QList<LayerRenderJob>::iterator, QtConcurrent::FunctionWrapper1<void, LayerRenderJob&> >::runIterations (this=0x76429d0, sequenceBeginIterator=...,
beginIndex=1, endIndex=2) at /usr/include/qt4/QtCore/qtconcurrentmapkernel.h:82
#21 0x00007ffff48c0d11 in QtConcurrent::IterateKernel<QList<LayerRenderJob>::iterator, void>::forThreadFunction (this=0x76429d0) at /usr/include/qt4/QtCore/qtconcurrentiteratekernel.h:263
#22 0x00007ffff48c0996 in QtConcurrent::IterateKernel<QList<LayerRenderJob>::iterator, void>::threadFunction (this=0x76429d0) at /usr/include/qt4/QtCore/qtconcurrentiteratekernel.h:225
#23 0x00007ffff3371b85 in QtConcurrent::ThreadEngineBase::run() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#24 0x00007ffff33736bd in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#25 0x00007ffff337fd0b in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#26 0x00007ffff024bb50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#27 0x00007ffff053d0ed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#28 0x0000000000000000 in ?? ()

debug_msg_connectionpool.diff Magnifier (1.08 KB) Martin Dobias, 2014-04-28 03:55 AM

Associated revisions

Revision dd739ef7
Added by Martin Dobias over 6 years ago

Fix #10127 (crash on parallel rendering of spatialite layers)

There was a run condition in connection pool singleton: at the beginning,
the singleton got initialized twice. Now the singleton is handled
as a static function variable which should be initialized in thread-safe way.

History

#1 Updated by Giovanni Manghi over 6 years ago

  • Category deleted (Browser)
  • Priority changed from Normal to High
  • Crashes QGIS or corrupts data changed from No to Yes

#2 Updated by Giovanni Manghi over 6 years ago

  • Affected QGIS version changed from 2.2.0 to master

#3 Updated by Martin Dobias over 6 years ago

Hi Luigi

that is really quite strange. When a connection is being released back to connection pool, its group should definitely exist because it was created earlier in acquireConnection() call - that's why it crashes on assert.

In theory I could just remove the assertion and ignore the issue, but we should try to investigate it. Please try to add some debug messages to the acquire/release connection functions to better understand what happens - I'm attaching a sample diff. With a next crash it would be good to investigate the sequence of acquire/release messages from the log.

Does it happen only if you use parallel rendering? Or can it happen also with sequential rendering?

#4 Updated by Luigi Pirelli over 6 years ago

I'm not able to understand steps to reproduce the error... happends again after I posted the tiket and I tried to replicate without success. I hope to collect more data.
I'll set sequencial rendering and report if it still crashes

#5 Updated by Luigi Pirelli over 6 years ago

added debug messages... i tried

1) with serial rendering... no crash
2) with parallel rendering... no crash using for long time, colsing and reopening a lot of time... one time after reopened and loaded the project, tried to open contextual menu with right mouse button... crash!

[New Thread 0x7fff7dbd7700 (LWP 16813)]
[New Thread 0x7fff7d3d6700 (LWP 16814)]
[New Thread 0x7fff7cbd5700 (LWP 16815)]
[New Thread 0x7fff77fff700 (LWP 16816)]
[New Thread 0x7fff777fe700 (LWP 16817)]
[New Thread 0x7fff76ffd700 (LWP 16818)]
[New Thread 0x7fff6e7fc700 (LWP 16819)]
src/core/qgsmaprendererjob.cpp: 889: (renderLayerStatic) job 5e5b0e0 start
src/core/qgsmaprendererjob.cpp: 889: (renderLayerStatic) job 60e73f0 start
src/core/qgsvectorlayerrenderer.cpp: 142: (render) Simplify - SourceTransformRect=632233.2731817171443254,4833669.1722715301439166 : 632333.2731817171443254,4833769.1722715301439166
src/core/qgsvectorlayerrenderer.cpp: 143: (render) Simplify - TargetTransformRect=1632262.6603378390427679,4833684.8972144871950150 : 1632362.6628487689886242,4833784.8988635614514351
src/core/qgsvectorlayerrenderer.cpp: 155: (render) Simplify - SourceHypothenuse=141.421
src/core/qgsvectorlayerrenderer.cpp: 156: (render) Simplify - TargetHypothenuse=141.424
src/providers/spatialite/../../core/qgsconnectionpool.h: 210: (acquireConnection) ACQUIRE: /home/ginetto/.qgis2/python/plugins/rt_geosisma_offline/./offlinedata/dbs/geosisma_geo.sqlite
src/providers/spatialite/../../core/qgsconnectionpool.h: 210: (acquireConnection) ACQUIRE: /home/ginetto/.qgis2/python/plugins/rt_geosisma_offline/./offlinedata/dbs/geosismadb.sqlite
src/providers/spatialite/../../core/qgsconnectionpool.h: 214: (acquireConnection) ACQUIRE new group: /home/ginetto/.qgis2/python/plugins/rt_geosisma_offline/./offlinedata/dbs/geosisma_geo.sqlite
src/providers/spatialite/../../core/qgsconnectionpool.h: 214: (acquireConnection) ACQUIRE new group: /home/ginetto/.qgis2/python/plugins/rt_geosisma_offline/./offlinedata/dbs/geosismadb.sqlite
src/providers/spatialite/qgsspatialiteconnection.cpp: 745: (openDb) New sqlite connection for /home/ginetto/.qgis2/python/plugins/rt_geosisma_offline/./offlinedata/dbs/geosismadb.sqlite
src/providers/spatialite/qgsspatialiteconnection.cpp: 745: (openDb) New sqlite connection for /home/ginetto/.qgis2/python/plugins/rt_geosisma_offline/./offlinedata/dbs/geosisma_geo.sqlite
src/providers/spatialite/qgsspatialiteconnection.cpp: 766: (openDb) Connection to the database was successful
src/providers/spatialite/qgsspatialiteconnection.cpp: 766: (openDb) Connection to the database was successful
src/providers/spatialite/../../core/qgsconnectionpool.h: 228: (releaseConnection) RELEASE: /home/ginetto/.qgis2/python/plugins/rt_geosisma_offline/./offlinedata/dbs/geosismadb.sqlite
src/providers/spatialite/../../core/qgsconnectionpool.h: 228: (releaseConnection) RELEASE: /home/ginetto/.qgis2/python/plugins/rt_geosisma_offline/./offlinedata/dbs/geosisma_geo.sqlite
Fatal: ASSERT: "it != mGroups.end()" in file /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/../../core/qgsconnectionpool.h, line 230
QGIS died on signal -1src/core/qgsmaprendererjob.cpp: 892: (renderLayerStatic) job 5e5b0e0 end [4 ms]
ptrace: Operation not permitted.
No thread selected
No stack.
gdb returned 0

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff7d3d6700 (LWP 16814)]
0x00007ffff048e475 in _GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
#0 0x00007ffff048e475 in *
_GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007ffff04916f0 in *__GI_abort () at abort.c:92
#2 0x000000000058aa6b in qgisCrash (signal=-1) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/app/main.cpp:303
#3 0x000000000058ac42 in myMessageOutput (type=QtFatalMsg, msg=
0x7fffd0108598 "ASSERT: \\"it != mGroups.end()\\" in file /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/../../core/qgsconnectionpool.h, line 230")
at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/app/main.cpp:356
#4 0x00007ffff3370630 in qt_message_output(QtMsgType, char const
) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5 0x00007ffff3370a98 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6 0x00007ffff3370c24 in qFatal(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7 0x00007fff8ad41c53 in QgsConnectionPool<QgsSqliteHandle*, QgsSpatiaLiteConnPoolGroup>::releaseConnection (this=0x7691210, conn=0x7fffd0105fc0)
at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/../../core/qgsconnectionpool.h:230
#8 0x00007fff8ad3d6bd in QgsSpatiaLiteFeatureIterator::close (this=0x7fffd009da80) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/qgsspatialitefeatureiterator.cpp:127
#9 0x00007fff8ad3d5ba in QgsSpatiaLiteFeatureIterator::fetchFeature (this=0x7fffd009da80, feature=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/providers/spatialite/qgsspatialitefeatureiterator.cpp:90
#10 0x00007ffff4a0963a in QgsAbstractFeatureIterator::nextFeature (this=0x7fffd009da80, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsfeatureiterator.cpp:51
#11 0x0000000000626e0c in QgsFeatureIterator::nextFeature (this=0x7fffd0107220, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/app/../core/qgsfeatureiterator.h:196
#12 0x00007ffff4b680f1 in QgsVectorLayerFeatureIterator::fetchFeature (this=0x7fffd0107120, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsvectorlayerfeatureiterator.cpp:199
#13 0x00007ffff4a0963a in QgsAbstractFeatureIterator::nextFeature (this=0x7fffd0107120, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsfeatureiterator.cpp:51
#14 0x0000000000626e0c in QgsFeatureIterator::nextFeature (this=0x7fff7d3d5950, f=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/app/../core/qgsfeatureiterator.h:196
#15 0x00007ffff48bef7f in QgsVectorLayerRenderer::drawRendererV2 (this=0x5e6c700, fit=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsvectorlayerrenderer.cpp:214
#16 0x00007ffff48be759 in QgsVectorLayerRenderer::render (this=0x5e6c700) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsvectorlayerrenderer.cpp:181
#17 0x00007ffff48b7441 in QgsMapRendererParallelJob::renderLayerStatic (job=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsmaprendererjob.cpp:890
#18 0x00007ffff48bc9f0 in QtConcurrent::FunctionWrapper1<void, LayerRenderJob&>::operator() (this=0x5ec0488, u=...) at /usr/include/qt4/QtCore/qtconcurrentfunctionwrappers.h:86
#19 0x00007ffff48bc70e in QtConcurrent::MapKernel<QList<LayerRenderJob>::iterator, QtConcurrent::FunctionWrapper1<void, LayerRenderJob&> >::runIteration (this=0x5ec0450, it=...)
at /usr/include/qt4/QtCore/qtconcurrentmapkernel.h:73
#20 0x00007ffff48bc793 in QtConcurrent::MapKernel<QList<LayerRenderJob>::iterator, QtConcurrent::FunctionWrapper1<void, LayerRenderJob&> >::runIterations (this=0x5ec0450, sequenceBeginIterator=...,
beginIndex=0, endIndex=1) at /usr/include/qt4/QtCore/qtconcurrentmapkernel.h:82
#21 0x00007ffff48bcca1 in QtConcurrent::IterateKernel<QList<LayerRenderJob>::iterator, void>::forThreadFunction (this=0x5ec0450) at /usr/include/qt4/QtCore/qtconcurrentiteratekernel.h:263
#22 0x00007ffff48bc926 in QtConcurrent::IterateKernel<QList<LayerRenderJob>::iterator, void>::threadFunction (this=0x5ec0450) at /usr/include/qt4/QtCore/qtconcurrentiteratekernel.h:225
#23 0x00007ffff336cb85 in QtConcurrent::ThreadEngineBase::run() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#24 0x00007ffff336e6bd in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#25 0x00007ffff337ad0b in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#26 0x00007ffff0246b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#27 0x00007ffff05380ed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#28 0x0000000000000000 in ?? ()

#6 Updated by Martin Dobias over 6 years ago

  • Status changed from Open to Closed

#7 Updated by Martin Dobias over 6 years ago

  • Resolution set to fixed/implemented

In the end I was able to replicate a crash with two layers from two different spatialite databases on project load. Thanks Luigi for the help!

#8 Updated by Luigi Pirelli over 6 years ago

it's a pleasure

Also available in: Atom PDF