Bug report #4909

qgis hang when postgres close the connection

Added by aperi2007 - over 7 years ago. Updated almost 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:14716

Description

Using qgis and postgres/postgis.
I notice that when I stop my work for a lot of time (40-50 minutes), postgres logically close the connection for client inactivity.
When I try to continue my work, qgis will hang waiting postgres will response. And is necessary to kill qgis and restart it.

I guess actually qgis open the connection to the postgres when I add a postgres table to the canvas and i presume it will remain open forever.
Instead qgis should test the connection every 10-15 minutes for every distinct istance of postgres used in the canvas and try to reopen the connection if it is find closed.

filipe_rafael_13_12_2011.qgs (176 KB) Giovanni Manghi, 2012-01-30 09:17 AM


Related issues

Duplicates QGIS Application - Bug report #3315: editing the attribute table POSTGIS in QGis via VPN Closed

Associated revisions

Revision 26239209
Added by Jürgen Fischer over 7 years ago

postgresql provider: check connection state before running PQexec (fixes #4909)

History

#1 Updated by Jürgen Fischer over 7 years ago

Which version do you use? master should survive connection losses.

#2 Updated by Giovanni Manghi over 7 years ago

Hi Jurgen, I'm using master. Just tested a 1 hour idle time, after that any action makes qgis hang.

#3 Updated by Jürgen Fischer over 7 years ago

Giovanni Manghi wrote:

Hi Jurgen, I'm using master. Just tested a 1 hour idle time, after that any action makes qgis hang.

Not reproducable here. And debug output?

#4 Updated by Giovanni Manghi over 7 years ago

Not reproducable here. And debug output?

try the attached project (with only postgis data). Let me know if it works fine for you.

#5 Updated by Jürgen Fischer over 7 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#6 Updated by aperi2007 - over 7 years ago

  • Status changed from Closed to Reopened

oops, it is again here.
I still experience with this bug.

After a while, when postgres close the connection,
qgis hang because don't re-open the connection.

I use postgres 9.1.3 and postgis 2.0 beta2.
Also I use qgis-dev (for windows ) 3a2c0e9.

Andrea.

#7 Updated by Giovanni Manghi over 7 years ago

it happens also with postgres 8.4/postgis 1.5 and qgis master

#8 Updated by Giovanni Manghi over 7 years ago

I use postgres 9.1.3 and postgis 2.0 beta2.
Also I use qgis-dev (for windows ) 3a2c0e9.

Andrea.

This may be not a QGIS problem after all. What I have noticed is that if I connect to a PostgreSQL server that is the same "local" network (in my case is the pretty big network of a University) then the connection does not fall. If I connect to the same server but from a remote connection then the connection falls after a while. I say that is probably not a QGIS problem because the same thing happens also with PgAdmin.

#9 Updated by Paolo Cavallini about 7 years ago

  • Target version set to Version 2.0.0

#10 Updated by Jürgen Fischer almost 6 years ago

  • Status changed from Reopened to Closed

Also available in: Atom PDF