From: jtv@xs4all.nl
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: jtv@xs4all.nl
Cc: pgsql-interfaces@postgresql.org
Subject: Re: libpq and connection failures
Date: Fri, 8 Jul 2005 05:24:16 +0200 (CEST)
Message-ID: <10014.202.47.227.25.1120793056.squirrel@202.47.227.25> (raw)
In-Reply-To: <28109.1120669187@sss.pgh.pa.us>
References: <21028.202.47.227.25.1120571298.squirrel@202.47.227.25>
<13032.1120574589@sss.pgh.pa.us>
<24362.202.47.227.25.1120635552.squirrel@202.47.227.25>
<28109.1120669187@sss.pgh.pa.us>
Tom Lane wrote:
>>> I think it's probably better to have the default assumption be
>>> "connection possibly recoverable" than have it be "summarily kill
>>> connection at first hint of trouble". The latter seems less robust
>>> not more so.
>
>> Not after the connection failure has made its way into a PGresult,
>> surely?
>
> Well, I've not had a whole lot of personal experience with flaky
> connections to a database ... what do other people think would be
> the most useful behavior?
I can only speak for libpqxx and some of its users. One has pulled a
network cable out and found that the error he ultimately received (after a
long timeout) looked like a query failure--and PQstatus still said
CONNECTION_OK, leaving libpqxx unable to diagnose the error type and throw
the appropriate exception type. Searching for the error text brought us
to the scene of the crime.
I don't see how this state of affairs can be acceptable *at all* given
that PQstatus exists and purports to report a connection's status. If
pulling out the network cable and not putting it back fails to meet our
definition of a broken connection, what meets it?
Another user ran into trouble because he couldn't connect to the database
due to an incorrectly formatted connection string, but didn't receive an
error. Instead he got a PGconn that as far as I can make out, seemed
fully functional (non-NULL and CONNECTION_OK), but wasn't. We happened to
discover what was going on because he printed out the result of PQdb()
without checking for a NULL result, and reported the resulting crash to
the libpqxx mailing list.
Jeroen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: jtv@xs4all.nl, tgl@sss.pgh.pa.us
Subject: Re: libpq and connection failures
In-Reply-To: <10014.202.47.227.25.1120793056.squirrel@202.47.227.25>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox