[QGIS-Developer] Tackling Postgis layers connection recover

kimaidou kimaidou at gmail.com
Tue Feb 5 04:43:40 PST 2019


+1000 Thanks for your help regarding this nasty issue

Le mar. 5 févr. 2019 à 08:00, Paolo Cavallini <cavallini at faunalia.it> a
écrit :

> Agreed, a long standing annoying issue. Thanks for taking it.
> Cheers.
>
> Il 4 febbraio 2019 23:32:39 CET, Nyall Dawson <nyall.dawson at gmail.com> ha
> scritto:
>>
>> On Tue, 5 Feb 2019 at 05:54, Timothé Perez <timothe at pragma-innovation.fr> 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     CRITICAL    Layer 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     WARNING    Commit errors : Could not commit changes to layer foo
>>>  2019-02-04T19:11:34     CRITICAL    Layer foo : PostGIS error while adding features: no result buffer
>>>  2019-02-04T19:11:34     WARNING    Commit 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 at 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 at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190205/7fe39242/attachment.html>


More information about the QGIS-Developer mailing list