Re: BUG #2576: tcp_keepalive doesn't work

From: Fujii Masao <fujii(dot)masao(at)oss(dot)ntt(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2576: tcp_keepalive doesn't work
Date: 2006-08-16 00:52:25
Message-ID: 44E26C49.9060108@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi.

> You seem to have a misunderstanding of what tcp_keepalive is for. It
> does not kill a backend that is in the midst of a query. A backend will
> terminate when it is waiting for a client command and it sees that the
> connection has been lost --- which is what a TCP timeout will cause to
> happen. But your example backends are not waiting for client commands.

No. In my example, there are backends that are waiting for client commands.

Please pay attention to the result of 'ps -ef | grep postgres'.

>> [terminal 4]
>> $ sleep 30
>> $ ps -ef | grep postgres
>> ...
>> postgres 16815 16782 0 17:06 pts/1 00:00:00 postgres: postgres sampledb
>> xx.xx.xx.xx(38738) idle in transaction
>> postgres 16816 16782 0 17:06 pts/1 00:00:00 postgres: postgres sampledb
>> xx.xx.xx.xx(38739) UPDATE waiting
>> postgres 16817 16782 0 17:06 pts/1 00:00:00 postgres: postgres sampledb
>> xx.xx.xx.xx(38740) UPDATE waiting
>> postgres 16818 16782 0 17:06 pts/1 00:00:00 postgres: postgres sampledb
>> xx.xx.xx.xx(38741) UPDATE waiting
>> postgres 16819 16782 0 17:06 pts/1 00:00:00 postgres: postgres sampledb
>> xx.xx.xx.xx(38742) UPDATE waiting
>> postgres 16820 16782 0 17:06 pts/1 00:00:00 postgres: postgres sampledb
>> xx.xx.xx.xx(38743) idle in transaction
>> postgres 16821 16782 0 17:06 pts/1 00:00:00 postgres: postgres sampledb
>> xx.xx.xx.xx(38744) UPDATE waiting
>> postgres 16822 16782 0 17:06 pts/1 00:00:00 postgres: postgres sampledb
>> xx.xx.xx.xx(38745) UPDATE waiting
>> postgres 16823 16782 0 17:06 pts/1 00:00:00 postgres: postgres sampledb
>> xx.xx.xx.xx(38746) idle
>> ...

'idle in transaction' backends don't terminate though they are waiting for
a client command and connection has been lost.

By the way, I ran strace for 'idle in transaction' backend.
-----
$ strace -p xxx
Process xxx attached - interrupt to quit
recv(7,
-----

best regards;

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Anita Lederer 2006-08-16 14:32:50 Re: out of memory
Previous Message Tom Lane 2006-08-15 20:48:37 Re: out of memory