Bug report #14140

Crash in QgsGeomColumnTypeThread stopping connection scan

Added by Sandro Santilli about 1 year ago. Updated about 1 year ago.

Status:Closed Start Date:01/19/2016
Priority:Normal Due date:
Assigned to:Sandro Santilli % Done:


Category:PostGIS Data Provider
Target version:Version 2.14
Platform: Pull Request or Patch supplied:No
Platform version: Affected version:master
Status info: Causes crash or corruption:Yes
Resolution: Tag:


I just got a segfault with current master (670ded3d0622811f8e0ba50b3f3fd5e783742044) by clicking on "stop" in the "Add PostGIS Layer" dialog, while it was scannign a database.

(gdb) bt
#0  0x00007fa6eb4ec12c in QString::QString (this=0x7fa6d98c8b40, other=...) at /usr/include/qt4/QtCore/qstring.h:725
#1  0x00007fa6eb510273 in QgsPostgresConn::connInfo (this=0x0) at /usr/src/qgis/qgis-master/src/providers/postgres/qgspostgresconn.h:308
#2  0x00007fa6eb510387 in qgsConnectionPool_ConnectionToName (c=0x0) at /usr/src/qgis/qgis-master/src/providers/postgres/qgspostgresconnpool.h:25
#3  0x00007fa6eb510c2a in QgsConnectionPool<QgsPostgresConn*, QgsPostgresConnPoolGroup>::releaseConnection (
    this=0x7fa6eb75ed50 <QgsPostgresConnPool::sInstance>, conn=0x0)
    at /usr/src/qgis/qgis-master/src/providers/postgres/../../core/qgsconnectionpool.h:264
#4  0x00007fa6eb5304aa in QgsGeomColumnTypeThread::run (this=0x2337220)
    at /usr/src/qgis/qgis-master/src/providers/postgres/qgscolumntypethread.cpp:115
#5  0x00007fa787bd132f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007fa78005c182 in start_thread (arg=0x7fa6d98c9700) at pthread_create.c:312
#7  0x00007fa7866be47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

It's still the QgsGeomColumnTypeThread...

Associated revisions

Revision 69cb0c4ed3174946c82e32dad4af5a12275079fc
Added by Sandro Santilli about 1 year ago

Fix double-release of postgresql connection on table retriveal stop

Also breaks earlier out of loop and print a different status
message on "stop" (rather than "complete").

Fixes #14140


Updated by Sandro Santilli about 1 year ago

==1984== Thread 11 QgsGeomColumnTypeThread:
==1984== Invalid read of size 8
==1984==    at 0x8355B12C: QString::QString(QString const&) (qstring.h:725)
==1984==    by 0x8357F272: QgsPostgresConn::connInfo() const (qgspostgresconn.h:308)
==1984==    by 0x8357F386: qgsConnectionPool_ConnectionToName(QgsPostgresConn*) (qgspostgresconnpool.h:25)
==1984==    by 0x8357FC29: QgsConnectionPool<QgsPostgresConn*, QgsPostgresConnPoolGroup>::releaseConnection(QgsPostgresConn*) (qgsconnectionpool.h:
==1984==    by 0x8359F4A9: QgsGeomColumnTypeThread::run() (qgscolumntypethread.cpp:115)

Updated by Sandro Santilli about 1 year ago

Got it, ColumnTypeThread handling of "stopped" (mStop) is not thread-safe.

Updated by Sandro Santilli about 1 year ago

  • Status changed from In Progress to Closed

Also available in: Atom