Graceful recovery if postgres connection is lost #499

artemp opened this Issue Oct 11, 2011 · 2 comments


None yet

3 participants

artemp commented Oct 11, 2011

Could be useful: ability to recover without exception if a database connection is lost abruptly.

RuntimeError: PSQL error: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. Full sql was: 'SELECT AsBinary("way",'NDR') AS ...

To recreate:

  • Run mapnik as a process within Apache
  • Restart postgres abruptly
  • Mapnik process inside apache hits exception after loosing connection, even after postgres is running again.

The priority behavior should be to maintain the ability to open new connections to a running postgres database server, but this above edge case would also be good to look into.

strk commented Mar 5, 2014

As of mapnik-2.2.x with libpq 9.1.12-0ubuntu0.13.10 a backend crash results in PQerrorMessage(conn_) returning an empty string, making the error less informative:

Error: layer0: Postgis Plugin:
Full sql was:...

Dunno if it's a libpq-9.3 issue or a mapnik issue, or something in higher layers...


great thanks for confirming this crash is gone. Now that error message is fixed as of #2173, closing.

@springmeyer springmeyer added this to the Mapnik 2.3.0 milestone Mar 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment