Bug report #4469

Postgis connection lost forever on backend restart.

Added by Sandro Santilli about 13 years ago. Updated about 12 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:1.7.3 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:14396

Description

Restarting the PostgreSQL server puts a QGis instance with PostGIS layers (bound to that specific server) into a silently failing state. That is all features disappear from the canvas at first reload w/out any notice of the problem.

PS: is it worth adding a "PostGIS Data Provider" category ? I have more to come...

History

#1 Updated by Giovanni Manghi about 13 years ago

  • Category changed from Data Provider to Data Provider/PostGIS

#2 Updated by Jürgen Fischer about 13 years ago

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

qgis now reconnects in case of failure (see b86243ed9f6be9766284bc2e8ea82e7d4c0fbb5e)

#3 Updated by Sandro Santilli about 13 years ago

I'm pretty sure I was using a later version.
Anyway, I'm rebuilding current master and will give it a try.

PS: would be helpful to have some kind of "Ready for test" status between Open and Closed.

#4 Updated by Sandro Santilli about 13 years ago

  • Resolution deleted (fixed)

Still being a problem as 7297b23
This is against postgresql 8.4

#5 Updated by Giovanni Manghi about 13 years ago

  • Status changed from Closed to Feedback

#6 Updated by Jürgen Fischer about 13 years ago

Sandro Santilli wrote:

Still being a problem as 7297b23
This is against postgresql 8.4

Works fine here - although with 8.3, but I doubt that makes a difference.

d:\\src\\qgis\\src\\providers\\postgres\\qgspostgresprovider.cpp(4198) : (QgsPostgresProvider::Conn::openCursor) Starting read-only transaction
Query: BEGIN READ ONLY returned 7 [FATAL:  terminating connection due to administrator command
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
]
d:\\src\\qgis\\src\\app\\qgscustomization.cpp(778) : (QgsCustomization::customizeWidget) objectName = QgsMessageViewer event type = 17
d:\\src\\qgis\\src\\app\\qgscustomization.cpp(780) : (QgsCustomization::customizeWidget) QgsMessageViewer x QDialog
d:\\src\\qgis\\src\\providers\\postgres\\qgspostgresprovider.cpp(4255) : (QgsPostgresProvider::Conn::PQexecNR) connection bad - resetting
d:\\src\\qgis\\src\\providers\\postgres\\qgspostgresprovider.cpp(4259) : (QgsPostgresProvider::Conn::PQexecNR) reconnected - retrying
d:\\src\\qgis\\src\\providers\\postgres\\qgspostgresprovider.cpp(1403) : (QgsPostgresProvider::nextFeature) finished after 1 features

#7 Updated by Sandro Santilli about 13 years ago

My logs:

FATAL:  terminating connection due to administrator command
Warning: Field -1 not found.
Warning: Field -1 not found.

I have 4 layers, two on edge_data and two on node each of two postgis topologies.
The edge_data layers are styled (old stylization) with unique value edge_id.

Will try to reduce the number of layers.

#8 Updated by Sandro Santilli about 13 years ago

Same with a single layer (edge_data) and no styling.

#9 Updated by Regis Haubourg about 13 years ago

With Qgis 1.8.0 8422a9d (16/11/2011 with osgeow), 2*postgres 9/ postgis 1.5 /1 pgpool2, when we stop one database, pgpool cut connections and recreate them. Qgis throws a first error message and then displays data correctly.

Proble solved for us. Thanks guys
Régis

#10 Updated by Giovanni Manghi about 13 years ago

Sandro Santilli wrote:

Same with a single layer (edge_data) and no styling.

it seems to me that is either not confirmed or fixed, can you check?

#11 Updated by Sandro Santilli about 13 years ago

A simple test with b6852f1 still shows the problem of things disappearing on backend restart.
Test:
- Open qgis
- Select a simple layer
- Zoom so you see where things are
- /etc/init.d/postgresql restart
- Pan a little bit to force redraw

Can't see the vectors anymore here...

Maybe this is helpful:
Debug: /usr/src/qgis/qgis/src/core/qgsmaprenderer.cpp: 367: (render) Rendering layer crossing
Debug: /usr/src/qgis/qgis/src/core/qgsmaprenderer.cpp: 368: (render) Layer minscale 0
Debug: /usr/src/qgis/qgis/src/core/qgsmaprenderer.cpp: 369: (render) Layer maxscale 1e+08
Debug: /usr/src/qgis/qgis/src/core/qgsmaprenderer.cpp: 370: (render) Scale dep. visibility enabled? 0
Debug: /usr/src/qgis/qgis/src/core/qgsmaprenderer.cpp: 371: (render) Input extent: Empty
Debug: /usr/src/qgis/qgis/src/core/qgspallabeling.cpp: 765: (prepareLayer) PREPARE LAYER
Debug: /usr/src/qgis/qgis/src/providers/postgres/qgspostgresprovider.cpp: 1607: (loadFields) Loading fields for table crossing
Debug: /usr/src/qgis/qgis/src/providers/postgres/qgspostgresprovider.cpp: 1375: (nextFeature) nextFeature() without select()

#12 Updated by Giovanni Manghi about 13 years ago

Then I cannot confirm the problem here

#13 Updated by Giovanni Manghi almost 13 years ago

  • Target version set to Version 1.7.4

#14 Updated by Jürgen Fischer almost 13 years ago

  • Affected QGIS version set to master
  • Crashes QGIS or corrupts data set to No

please verify that the problem still exists in master.

#15 Updated by Sandro Santilli almost 13 years ago

  • Affected QGIS version changed from master to 1.7.3

While trying in master I got another 2 different issues. First was a zero-length identifier for an "Identify" query, the secodn was a crash on backend restart.

This ticket is specifically for 1.7 though, not master. Can it be fixed in there ?

#16 Updated by Paolo Cavallini over 12 years ago

  • Target version changed from Version 1.7.4 to Version 1.8.0

#17 Updated by Paolo Cavallini about 12 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#18 Updated by Sandro Santilli about 12 years ago

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

I tried 1.8.0 and it works fine. Also master works fine.

Also available in: Atom PDF