Re: libpq connection status and closed fd

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: libpq connection status and closed fd
Дата
Msg-id 12708.1411394055@sss.pgh.pa.us
обсуждение исходный текст
Ответ на libpq connection status and closed fd  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список pgsql-hackers
Daniele Varrazzo <daniele.varrazzo@gmail.com> writes:
> a psycopg user is reporting [1] that the library is not marking the
> connection as closed and/or bad after certain errors, such as a
> connection timeout. He is emulating the error by closing the
> connection fd

That seems like a completely illegitimate test procedure.  A network
failure does not result in automatic closure of the FD so there is
no reason for the libpq code to be expecting that to happen.  Instead,
it expects to see an appropriate error code next time it tries to
use the socket.

If you want to test for connection loss, consider doing a kill -9 on
the connected backend (best not to do that with a production server
of course).

A larger point is that your user may well have false expectations
about how quickly libpq will detect connection loss.  Generally
that won't happen until it next tries to transmit or receive some
data; so a simple PQstatus() call doesn't prove a lot about whether
the connection has been lost since the last query.  This is not a
bug either IMO.
        regards, tom lane



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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Index scan optimization
Следующее
От: Tom Lane
Дата:
Сообщение: Re: documentation references invalid -A assertion checks option