tcp keep alive don't work when the backend is busy

Поиск
Список
Период
Сортировка
От Олег Самойлов
Тема tcp keep alive don't work when the backend is busy
Дата
Msg-id 3F592B64-264F-4E95-B555-7E7C9E8F57B8@ya.ru
обсуждение исходный текст
Ответы Re: tcp keep alive don't work when the backend is busy  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: tcp keep alive don't work when the backend is busy  (Justin <zzzzz.graf@gmail.com>)
Список pgsql-general
According to the documentation
https://www.postgresql.org/docs/12/runtime-config-connection.html
A backend must check connection to the client by tcp_keepalive messages. (Config option tcp_keepalives_idle).

But this is don't work if the backend is busy.

Simple example:

psql localhost

set tcp_keepalives_idle=1;
do $$begin loop perform pg_sleep(1);end loop;end;$$;

In other terminal kill -9 the psql on the first terminal.

select * from pg_stat_activity where state='active';
And we will see that the backend is still active and busy.

The more realistic example. In the real code one of the loops, due to bug with asynchronous communication, come to the
infiniteloop. And occupy a backend and locks for a two week after the client was killed, before we detected this.  


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

Предыдущее
От: stan
Дата:
Сообщение: server will not start (Debian)
Следующее
От: Олег Самойлов
Дата:
Сообщение: PGUSER and initdb