Re: [QGIS-Developer] Tackling Postgis layers connection recover

2019-02-06 Thread kimaidou
Here is the pull request kindly provided by Timothé
https://github.com/qgis/QGIS/pull/9107

Le mar. 5 févr. 2019 à 13:43, kimaidou  a écrit :

> +1000 Thanks for your help regarding this nasty issue
>
> Le mar. 5 févr. 2019 à 08:00, Paolo Cavallini  a
> écrit :
>
>> Agreed, a long standing annoying issue. Thanks for taking it.
>> Cheers.
>>
>> Il 4 febbraio 2019 23:32:39 CET, Nyall Dawson 
>> ha scritto:
>>>
>>> On Tue, 5 Feb 2019 at 05:54, Timothé Perez  
>>> wrote:
>>> >
>>>
  Hello qgis-devs,

  This is my first message here and first contribution to QGIS, so I thank 
 you in advance for being indulgent and do not hesitate to correct me on 
 any mistake I will make.
  I didn't want to jump right into proposing my patch "as is" in a PR as 
 I'm new to this project, so first I wanted to discuss about it to make 
 sure I got it right.

  Here's a recap of what I have found so far (sorry if it's a bit long):

  I'm using QGIS 3.4 with a PostgreSQL database to store layers and I'm 
 facing the same issue as described in https://issues.qgis.org/issues/20170 
 : unrecoverable PostgreSQL connections.

  I have cloned the repo and started to dig, as it is really annoying 
 because it forces you to abandon your changes and close and reopen your 
 project.

>>>
>>> Upfront, thanks for the great attitude. This is one of the MOST
>>> effective ways to get bugs fixed... rolling up your sleeves and fixing
>>> them yourself!
>>>
>>>  To reproduce the problem, the simplest way is to spin a local PostgreSQL 
>>> database with postgis and create a table with just a serial and a geometry:
   CREATE TABLE foo (id serial primary key, geometry GEOMETRY(POINT, 4326));

  Open it in QGIS, create several features, save them then simply restart 
 the PostgreSQL service so that all connections are forced to be closed.
  QGIS logs will display that the connections to PostgreSQL were lost but 
 recovered and features will still be accessible.

  However if I start editing the layer by adding a feature and then call 
 save, it will fail:

  2019-02-04T19:11:30 CRITICALLayer foo : PostGIS error while 
 adding features: FATAL: terminating connection due to administrator command
   la connexion au serveur a été coupée de façon inattendue
Le serveur s'est peut-être arrêté anormalement avant ou 
 durant le
traitement de la requête.

  2019-02-04T19:11:30 WARNINGCommit errors : Could not commit 
 changes to layer foo
  2019-02-04T19:11:34 CRITICALLayer foo : PostGIS error while 
 adding features: no result buffer
  2019-02-04T19:11:34 WARNINGCommit errors : Could not commit 
 changes to layer foo

  My only option is to cancel my edits and reload the project to regain 
 full access to the db.

  So in fact this problem has 2 causes: (time to dig in the C++ code)

 *snip*
>>> >
>>>
 I am willing to propose a PR if my fixes make sense and are acceptable, 
 this will fix an annoying issue.

>>>
>>> They both sound reasonable to me, and yes, valuables fixes for an
>>> annoying issues! Looking forward to the PRs! (One request: please file
>>> these as two separate PRs, so both fixes can be discussed and reviewed
>>> independently.)
>>>
>>> Nyall
>>> --
>>> QGIS-Developer mailing list
>>> QGIS-Developer@lists.osgeo.org
>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>>>
>> --
>> Sorry for being short
>> ___
>> QGIS-Developer mailing list
>> QGIS-Developer@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Tackling Postgis layers connection recover

2019-02-05 Thread kimaidou
+1000 Thanks for your help regarding this nasty issue

Le mar. 5 févr. 2019 à 08:00, Paolo Cavallini  a
écrit :

> Agreed, a long standing annoying issue. Thanks for taking it.
> Cheers.
>
> Il 4 febbraio 2019 23:32:39 CET, Nyall Dawson  ha
> scritto:
>>
>> On Tue, 5 Feb 2019 at 05:54, Timothé Perez  
>> wrote:
>> >
>>
>>>  Hello qgis-devs,
>>>
>>>  This is my first message here and first contribution to QGIS, so I thank 
>>> you in advance for being indulgent and do not hesitate to correct me on any 
>>> mistake I will make.
>>>  I didn't want to jump right into proposing my patch "as is" in a PR as I'm 
>>> new to this project, so first I wanted to discuss about it to make sure I 
>>> got it right.
>>>
>>>  Here's a recap of what I have found so far (sorry if it's a bit long):
>>>
>>>  I'm using QGIS 3.4 with a PostgreSQL database to store layers and I'm 
>>> facing the same issue as described in https://issues.qgis.org/issues/20170 
>>> : unrecoverable PostgreSQL connections.
>>>
>>>  I have cloned the repo and started to dig, as it is really annoying 
>>> because it forces you to abandon your changes and close and reopen your 
>>> project.
>>>
>>
>> Upfront, thanks for the great attitude. This is one of the MOST
>> effective ways to get bugs fixed... rolling up your sleeves and fixing
>> them yourself!
>>
>>  To reproduce the problem, the simplest way is to spin a local PostgreSQL 
>> database with postgis and create a table with just a serial and a geometry:
>>>   CREATE TABLE foo (id serial primary key, geometry GEOMETRY(POINT, 4326));
>>>
>>>  Open it in QGIS, create several features, save them then simply restart 
>>> the PostgreSQL service so that all connections are forced to be closed.
>>>  QGIS logs will display that the connections to PostgreSQL were lost but 
>>> recovered and features will still be accessible.
>>>
>>>  However if I start editing the layer by adding a feature and then call 
>>> save, it will fail:
>>>
>>>  2019-02-04T19:11:30 CRITICALLayer foo : PostGIS error while adding 
>>> features: FATAL: terminating connection due to administrator command
>>>   la connexion au serveur a été coupée de façon inattendue
>>>Le serveur s'est peut-être arrêté anormalement avant ou 
>>> durant le
>>>traitement de la requête.
>>>
>>>  2019-02-04T19:11:30 WARNINGCommit errors : Could not commit 
>>> changes to layer foo
>>>  2019-02-04T19:11:34 CRITICALLayer foo : PostGIS error while adding 
>>> features: no result buffer
>>>  2019-02-04T19:11:34 WARNINGCommit errors : Could not commit 
>>> changes to layer foo
>>>
>>>  My only option is to cancel my edits and reload the project to regain full 
>>> access to the db.
>>>
>>>  So in fact this problem has 2 causes: (time to dig in the C++ code)
>>>
>>> *snip*
>> >
>>
>>> I am willing to propose a PR if my fixes make sense and are acceptable, 
>>> this will fix an annoying issue.
>>>
>>
>> They both sound reasonable to me, and yes, valuables fixes for an
>> annoying issues! Looking forward to the PRs! (One request: please file
>> these as two separate PRs, so both fixes can be discussed and reviewed
>> independently.)
>>
>> Nyall
>> --
>> QGIS-Developer mailing list
>> QGIS-Developer@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
> --
> Sorry for being short
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Tackling Postgis layers connection recover

2019-02-04 Thread Paolo Cavallini
Agreed, a long standing annoying issue. Thanks for taking it.
Cheers.

Il 4 febbraio 2019 23:32:39 CET, Nyall Dawson  ha 
scritto:
>On Tue, 5 Feb 2019 at 05:54, Timothé Perez
> wrote:
>>
>> Hello qgis-devs,
>>
>> This is my first message here and first contribution to QGIS, so I
>thank you in advance for being indulgent and do not hesitate to correct
>me on any mistake I will make.
>> I didn't want to jump right into proposing my patch "as is" in a PR
>as I'm new to this project, so first I wanted to discuss about it to
>make sure I got it right.
>>
>> Here's a recap of what I have found so far (sorry if it's a bit
>long):
>>
>> I'm using QGIS 3.4 with a PostgreSQL database to store layers and I'm
>facing the same issue as described in
>https://issues.qgis.org/issues/20170 : unrecoverable PostgreSQL
>connections.
>>
>> I have cloned the repo and started to dig, as it is really annoying
>because it forces you to abandon your changes and close and reopen your
>project.
>
>Upfront, thanks for the great attitude. This is one of the MOST
>effective ways to get bugs fixed... rolling up your sleeves and fixing
>them yourself!
>
>> To reproduce the problem, the simplest way is to spin a local
>PostgreSQL database with postgis and create a table with just a serial
>and a geometry:
>>  CREATE TABLE foo (id serial primary key, geometry GEOMETRY(POINT,
>4326));
>>
>> Open it in QGIS, create several features, save them then simply
>restart the PostgreSQL service so that all connections are forced to be
>closed.
>> QGIS logs will display that the connections to PostgreSQL were lost
>but recovered and features will still be accessible.
>>
>> However if I start editing the layer by adding a feature and then
>call save, it will fail:
>>
>> 2019-02-04T19:11:30 CRITICALLayer foo : PostGIS error while
>adding features: FATAL: terminating connection due to administrator
>command
>>  la connexion au serveur a été coupée de façon inattendue
>>   Le serveur s'est peut-être arrêté anormalement avant ou
>durant le
>>   traitement de la requête.
>>
>> 2019-02-04T19:11:30 WARNINGCommit errors : Could not commit
>changes to layer foo
>> 2019-02-04T19:11:34 CRITICALLayer foo : PostGIS error while
>adding features: no result buffer
>> 2019-02-04T19:11:34 WARNINGCommit errors : Could not commit
>changes to layer foo
>>
>> My only option is to cancel my edits and reload the project to regain
>full access to the db.
>>
>> So in fact this problem has 2 causes: (time to dig in the C++ code)
>>
>*snip*
>>
>> I am willing to propose a PR if my fixes make sense and are
>acceptable, this will fix an annoying issue.
>
>They both sound reasonable to me, and yes, valuables fixes for an
>annoying issues! Looking forward to the PRs! (One request: please file
>these as two separate PRs, so both fixes can be discussed and reviewed
>independently.)
>
>Nyall
>___
>QGIS-Developer mailing list
>QGIS-Developer@lists.osgeo.org
>List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
Sorry for being short___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Tackling Postgis layers connection recover

2019-02-04 Thread Nyall Dawson
On Tue, 5 Feb 2019 at 05:54, Timothé Perez  wrote:
>
> Hello qgis-devs,
>
> This is my first message here and first contribution to QGIS, so I thank you 
> in advance for being indulgent and do not hesitate to correct me on any 
> mistake I will make.
> I didn't want to jump right into proposing my patch "as is" in a PR as I'm 
> new to this project, so first I wanted to discuss about it to make sure I got 
> it right.
>
> Here's a recap of what I have found so far (sorry if it's a bit long):
>
> I'm using QGIS 3.4 with a PostgreSQL database to store layers and I'm facing 
> the same issue as described in https://issues.qgis.org/issues/20170 : 
> unrecoverable PostgreSQL connections.
>
> I have cloned the repo and started to dig, as it is really annoying because 
> it forces you to abandon your changes and close and reopen your project.

Upfront, thanks for the great attitude. This is one of the MOST
effective ways to get bugs fixed... rolling up your sleeves and fixing
them yourself!

> To reproduce the problem, the simplest way is to spin a local PostgreSQL 
> database with postgis and create a table with just a serial and a geometry:
>  CREATE TABLE foo (id serial primary key, geometry GEOMETRY(POINT, 4326));
>
> Open it in QGIS, create several features, save them then simply restart the 
> PostgreSQL service so that all connections are forced to be closed.
> QGIS logs will display that the connections to PostgreSQL were lost but 
> recovered and features will still be accessible.
>
> However if I start editing the layer by adding a feature and then call save, 
> it will fail:
>
> 2019-02-04T19:11:30 CRITICALLayer foo : PostGIS error while adding 
> features: FATAL: terminating connection due to administrator command
>  la connexion au serveur a été coupée de façon inattendue
>   Le serveur s'est peut-être arrêté anormalement avant ou durant 
> le
>   traitement de la requête.
>
> 2019-02-04T19:11:30 WARNINGCommit errors : Could not commit changes 
> to layer foo
> 2019-02-04T19:11:34 CRITICALLayer foo : PostGIS error while adding 
> features: no result buffer
> 2019-02-04T19:11:34 WARNINGCommit errors : Could not commit changes 
> to layer foo
>
> My only option is to cancel my edits and reload the project to regain full 
> access to the db.
>
> So in fact this problem has 2 causes: (time to dig in the C++ code)
>
*snip*
>
> I am willing to propose a PR if my fixes make sense and are acceptable, this 
> will fix an annoying issue.

They both sound reasonable to me, and yes, valuables fixes for an
annoying issues! Looking forward to the PRs! (One request: please file
these as two separate PRs, so both fixes can be discussed and reviewed
independently.)

Nyall
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer