Bug report #13141

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

Added by baditaflorin - over 8 years ago. Updated about 8 years ago.

Status:Closed
Priority:High
Assignee:Sandro Santilli
Category:Data Provider/PostGIS
Affected QGIS version:2.8.5 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:21205

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 -, 2015-07-22 08:06 AM

History

#1 Updated by Giovanni Manghi over 8 years 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
  • Crashes QGIS or corrupts data changed from No to Yes

#2 Updated by Jürgen Fischer over 8 years ago

  • Category set to Data Provider/PostGIS

#3 Updated by Sandro Santilli about 8 years ago

  • Assignee set to Sandro Santilli

I'm taking this

#4 Updated by Sandro Santilli about 8 years ago

  • Status changed from Open to In Progress

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

#5 Updated by Sandro Santilli about 8 years 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 ***\
")
    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

#6 Updated by Sandro Santilli about 8 years ago

Same problem happens with 2.8.4

#7 Updated by Sandro Santilli about 8 years 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.

#8 Updated by Sandro Santilli about 8 years 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

#9 Updated by Sandro Santilli about 8 years 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

#10 Updated by Sandro Santilli about 8 years 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

#11 Updated by Sandro Santilli about 8 years ago

  • Affected QGIS version changed from 2.10.0 to 2.8.5

#12 Updated by Sandro Santilli about 8 years ago

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

Also available in: Atom PDF