The following bug has been logged online:
Bug reference: 2883
Logged by: Christopher Brian Jurado
Email address: chris.jurado@primesoft.ph
PostgreSQL version: 8.1
Operating system: Windows 2000/XP
Description: TCP Keep Alive not enabled even after setting it in
postresql.conf
Details:
The TCP keepalives do not work or is not enabled.
For Windows, in order to control the keepalive settings, you have to add
some entries to its registry. But, its TCP keepalive is disabled by default.
It has to be enabled for the socket using the setsockopt() command.
Did you guys add the setsockopt() command to enable the SO_KEEPALIVE option?
could this setting be added in the postgresql.conf?
We are having touble with this because if a client's network connection
fails, and the client still has an active transaction with locks, those
locks are never released!
As a reference, here is the info about TCP Keepalive Messages on the
Microsoft Knowledgebase:
"TCP Keepalive Messages
A TCP keepalive packet is simply an ACK with the sequence number set to one
less than the current sequence number for the connection. A computer
receiving one of these ACKs should respond with an ACK for the current
sequence number. Keepalives can be used to verify that the computer at the
remote end of a connection is still available. TCP keepalives can be sent
once every KeepAliveTime (defaults to 7,200,000 milliseconds or two hours),
if no other data or higher level keepalives have been carried over the TCP
connection. If there is no response to a keepalive, it is repeated once
every KeepAliveInterval seconds. KeepAliveInterval defaults to one second.
NetBT connections, such as those used by many Microsoft networking
components, send NetBIOS keepalives more frequently, and so normally no TCP
keepalives will be sent on a NetBIOS connection. TCP keepalives are disabled
by default, but Windows Sockets programs may enable them using setsockopt().
"