Bug report #13141

Postgis Connection freeze if you press "Set filter" during loading of data

Added by baditaflorin - almost 2 years ago. Updated over 1 year ago.

Status:Closed Start Date:07/22/2015
Priority:High Due date:
Assigned to:Sandro Santilli % Done:

0%

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

Description

If you press "SET filter" button, while the connection it`s still searching for other databases , then QGIS will freeze.

If you press stop and then you click set filter, it will work.

Also, sometimes it`s takes up to 1 minute to load all the tables, and i just need the last table

Capture.PNG (66.6 kB) baditaflorin -, 07/22/2015 08:06 am

History

Updated by Giovanni Manghi over 1 year ago

  • Subject changed from Postgis Connection freeze if you press Set filter during loading of data to Postgis Connection freeze if you press "Set filter" during loading of data
  • Priority changed from Normal to High
  • Target version set to Future Release - High Priority
  • Causes crash or corruption changed from No to Yes

Updated by J├╝rgen Fischer over 1 year ago

  • Category set to PostGIS Data Provider

Updated by Sandro Santilli over 1 year ago

  • Assigned to set to Sandro Santilli

I'm taking this

Updated by Sandro Santilli over 1 year ago

  • Status changed from Open to In Progress

I could reproduce with current master (9a2f46e) on ubuntu 14.04

Updated by Sandro Santilli over 1 year ago

It might be related to clicking on "Set Filter" twice.
I could also get: * Error in `output/bin/qgis': double free or corruption (out): 0x00007f2c1802c2d0 *
With the following backtrace:

#0  0x00007f2c4db10cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007f2c4db140d8 in __GI_abort () at abort.c:89
#2  0x00007f2c4db4d394 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7f2c4dc5bb28 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007f2c4db5966e in malloc_printerr (ptr=<optimized out>, str=0x7f2c4dc5bc58 "double free or corruption (out)", action=1) at malloc.c:4996
#4  _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:3840
#5  0x00007f2c42ab5fb8 in PQexecFinish (conn=0x7f2c1800a280) at fe-exec.c:2014
#6  0x00007f2bb69a2091 in QgsPostgresConn::PQexec (this=0x7f2c1800a190, query=..., logError=true)
    at /usr/src/qgis/qgis-master/src/providers/postgres/qgspostgresconn.cpp:974
#7  0x00007f2bb6970739 in QgsPostgresProvider::hasSufficientPermsAndCapabilities (this=0x567d3f0)
    at /usr/src/qgis/qgis-master/src/providers/postgres/qgspostgresprovider.cpp:997
#8  0x00007f2bb6969187 in QgsPostgresProvider::QgsPostgresProvider (this=0x567d3f0, uri=...)
    at /usr/src/qgis/qgis-master/src/providers/postgres/qgspostgresprovider.cpp:117
#9  0x00007f2bb6989051 in classFactory (uri=0x564b9e8) at /usr/src/qgis/qgis-master/src/providers/postgres/qgspostgresprovider.cpp:3625
#10 0x00007f2c4fa68753 in QgsProviderRegistry::provider (this=0x26d1940, providerKey=..., dataSource=...)
    at /usr/src/qgis/qgis-master/src/core/qgsproviderregistry.cpp:394
#11 0x00007f2c4fabc1ba in QgsVectorLayer::setDataProvider (this=0x564b9b0, provider=...)
    at /usr/src/qgis/qgis-master/src/core/qgsvectorlayer.cpp:1498
#12 0x00007f2c4fabbf95 in QgsVectorLayer::setDataSource (this=0x564b9b0, dataSource=..., baseName=..., provider=..., loadDefaultStyleFlag=true)
    at /usr/src/qgis/qgis-master/src/core/qgsvectorlayer.cpp:1456
#13 0x00007f2c4fab4e94 in QgsVectorLayer::QgsVectorLayer (this=0x564b9b0, vectorLayerPath=..., baseName=..., providerKey=..., 
    loadDefaultStyleFlag=true) at /usr/src/qgis/qgis-master/src/core/qgsvectorlayer.cpp:159
#14 0x00007f2bb69c34d8 in QgsPgSourceSelect::setSql (this=0x52c5fe0, index=...)
    at /usr/src/qgis/qgis-master/src/providers/postgres/qgspgsourceselect.cpp:614
#15 0x00007f2bb69c1a05 in QgsPgSourceSelect::buildQuery (this=0x52c5fe0)
    at /usr/src/qgis/qgis-master/src/providers/postgres/qgspgsourceselect.cpp:360
#16 0x00007f2bb69d52fb in QgsPgSourceSelect::qt_static_metacall (_o=0x52c5fe0, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0x7fffc09566c0)
    at /usr/src/qgis/build/master/src/providers/postgres/moc_qgspgsourceselect.cxx:164
#17 0x00007f2c4f1fd87a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#18 0x00007f2c4ebd1172 in QAbstractButton::clicked(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4

Updated by Sandro Santilli over 1 year ago

Same problem happens with 2.8.4

Updated by Sandro Santilli over 1 year ago

I think the problem is with sharing the same connection. Forcing all connections to not be shared fixes this issue.
I'm not sure why sharing is decided at connection construction time.

Updated by Sandro Santilli over 1 year ago

  • Pull Request or Patch supplied changed from No to Yes

PR ready for test by original reporter and discussion by other developers: https://github.com/qgis/QGIS/pull/2689

Updated by Sandro Santilli over 1 year ago

  • Status changed from In Progress to Feedback
  • Target version changed from Future Release - High Priority to Version 2.14

Bug should be fixed with commit 4ccb08dbadaca8153f69ddda7ab8b3b79729239b -- please test

Updated by Sandro Santilli over 1 year ago

I've added an assert to guard against any other such dangerous use of shared pgsql connections here: https://github.com/qgis/QGIS/pull/2695

Updated by Sandro Santilli over 1 year ago

  • Affected version changed from 2.10.0 to 2.8.5

Updated by Sandro Santilli over 1 year ago

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

Also available in: Atom