Re: BUG #5837: PQstatus() fails to report lost connection

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: BUG #5837: PQstatus() fails to report lost connection
Дата
Msg-id AANLkTinZAdPCX685ecg2_eVXJ1vDNXL4Ki-B1rFN=Z3h@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #5837: PQstatus() fails to report lost connection  ("Murray S. Kucherawy" <msk@cloudmark.com>)
Ответы Re: BUG #5837: PQstatus() fails to report lost connection  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Thu, Jan 13, 2011 at 8:36 PM, Murray S. Kucherawy <msk@cloudmark.com> wr=
ote:
>
> The following bug has been logged online:
>
> Bug reference: =A0 =A0 =A05837
> Logged by: =A0 =A0 =A0 =A0 =A0Murray S. Kucherawy
> Email address: =A0 =A0 =A0msk@cloudmark.com
> PostgreSQL version: 9.0.2
> Operating system: =A0 FreeBSD
> Description: =A0 =A0 =A0 =A0PQstatus() fails to report lost connection
> Details:
>
> I'm accessing libpq via OpenDBX, but it appears to be doing the right thi=
ng.
> =A0This 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. =A0However, of course, no further queries =
will
> succeed.

I can reproduce this by hacking up src/test/examples/testlibpq to
loop, but I'm not totally sure what's causing the behavior.  I think
the problem may be that libpq only reads enough from the connection to
get the FATAL error.  It doesn't keep reading to see whether there's
an EOF afterward, and thus doesn't immediately realize that the
connection has been closed.

--=20
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: BUG #5841: rank()+1 fails, 1+rank() succeeds
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5837: PQstatus() fails to report lost connection