The following bug has been logged online:
Bug reference: 2576
Logged by: Fujii Masao
Email address: fujii.masao@oss.ntt.co.jp
PostgreSQL version: 8.1.4
Operating system: Fedora Core 5
Description: tcp_keepalive doesn't work
Details:
Hi.
I found an error that tcp_keepalive doesn't work.
The sequence of steps to reproduce the problem is as follow.
----------
[terminal 1]
$ postmaster -p xxxx
NOTE:
- postgresql.conf that I changed from the default is as follow.
listen_addresses = '*'
tcp_keepalives_idle = 10
tcp_keepalives_interval = 5
tcp_keepalives_count = 2
- I add the Client Authentication Record to pg_hba.conf.
host all all xx.xx.xx.xx/xx trust
[terminal 2]
$ pgbench testdb -c 50 -t 100 -h xx.xx.xx.xx -p xxxx
[terminal 3]
# /sbin/ifdown eth0 #ifdown while running pgbench
Then, 50 postgres processes keep alive though tcp_keepalive
should kill them within 30 seconds at latest.
[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
...
----------
I'll be pleased if you cope with the problem.
Thanks in advance.