From: Murray S. Kucherawy <msk@cloudmark.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #5837: PQstatus() fails to report lost connection
Date: Fri, 14 Jan 2011 01:36:29 GMT
Message-ID: <201101140136.p0E1aTFb017852@wwwmaster.postgresql.org> (raw)
The following bug has been logged online:
Bug reference: 5837
Logged by: Murray S. Kucherawy
Email address: msk@cloudmark.com
PostgreSQL version: 9.0.2
Operating system: FreeBSD
Description: PQstatus() fails to report lost connection
Details:
I'm accessing libpq via OpenDBX, but it appears to be doing the right thing.
This is reproducible.
1) establish a connection to postgresql
2) initiate a query, collect results, etc.; all normal
3) while client is idle, restart the server
4) initiate the very same query as before
5) call PQgetResult(), returns non-NULL
6) call PQresultStatus(), returns PGRES_FATAL_ERROR
7) call PQstatus(), returns CONNECTION_OK
This causes the caller not to try PQreset() or equivalent, because the
connection is presumably fine. However, of course, no further queries will
succeed.
A call to PQerrorMessage() returns the string "FATAL: terminating connection
due to administrator command", which would be expected.
I would hate to have to have the application pull that out each time and
look for this specific string to detect the dead connection.
What happens internally prior to (7) appears to be a bug. I looked through
the "TODO" list and didn't see any mention of this.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: msk@cloudmark.com
Subject: Re: BUG #5837: PQstatus() fails to report lost connection
In-Reply-To: <201101140136.p0E1aTFb017852@wwwmaster.postgresql.org>
References: <201101140136.p0E1aTFb017852@wwwmaster.postgresql.org>
* 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