Обсуждение: PostgreSQL server does not notice that clients have disappeared

Поиск
Список
Период
Сортировка

PostgreSQL server does not notice that clients have disappeared

От
Al Eridani
Дата:
More than five years ago Tom Lane wrote

"It's not easy to tell whether a client has disconnected (particularly if
the network stack is unhelpful, which is depressingly often true).
Postgres will cancel a query if it gets told that the connection's been
dropped, but it will only discover this when an attempt to output to the
client fails. It does not spend cycles looking aside to see if the
connection has dropped when it is doing something that doesn't involve
output to the client."

Is this still true on the 9.x versions? Thanks!

Re: PostgreSQL server does not notice that clients have disappeared

От
Maciek Sakrejda
Дата:
On Fri, Jan 23, 2015 at 12:08 PM, Al Eridani <al.eridani@gmail.com> wrote:
Is this still true on the 9.x versions? Thanks!

It is, unfortunately. If your client kicks off a 12h query and immediately closes the TCP connection, Postgres won't notice until the query has completed.

Re: PostgreSQL server does not notice that clients have disappeared

От
Al Eridani
Дата:
Thank you for the confirmation!

On Fri, Jan 23, 2015 at 1:24 PM, Maciek Sakrejda <maciek@heroku.com> wrote:
On Fri, Jan 23, 2015 at 12:08 PM, Al Eridani <al.eridani@gmail.com> wrote:
Is this still true on the 9.x versions? Thanks!

It is, unfortunately. If your client kicks off a 12h query and immediately closes the TCP connection, Postgres won't notice until the query has completed.