There are tcp_keepalives on the server side of postgresql<br />The problem was that debian waits 2 hours before
startingthe keepalives (7200 s). <br />Also, the connection would only be kept alive for 9*75 s, which is 11 min.<br
/><br/>So i changed the tcp_keepalives_idle to 120 (keepalives start after 2 min) <br />and the tcp_keepalives_count
to 200 (max 200 keepalives are sent, every 75 secs, so the connection is kept alive for 120+(200*75) secs, which is 4.2
hours.<br/><br />It seems to have worked.<br />I'll check if it works on Windows.<br /><br />==in postgresql.conf==<br
/>#- TCP Keepalives -<br /># see "man 7 tcp" for details<br /><br />#tcp_keepalives_idle = 0 #
TCP_KEEPIDLE,in seconds;<br /> # 0 selects the system default<br
/>#tcp_keepalives_interval= 0 # TCP_KEEPINTVL, in seconds;<br /> # 0
selectsthe system default<br />#tcp_keepalives_count = 0 # TCP_KEEPCNT;<br />
# 0 selects the system default<br /><br /><br /><br />==in man 7 tcp (debian
lenny)==<br/> tcp_keepalive_intvl (integer; default: 75)<br /> The number of seconds between TCP
keep-aliveprobes.<br /><br /> tcp_keepalive_probes (integer; default: 9)<br /> The maximum number of
TCPkeep-alive probes to send before giving up and killing the connection if no response is obtained from the other
end.<br/><br /> tcp_keepalive_time (integer; default: 7200)<br /> The number of seconds a
connection needs to be idle before TCP begins sending out keep-alive probes. Keep-alives are only sent when the
SO_KEEPALIVEsocket<br /> option is enabled. The default value is 7200 seconds (2 hours). An idle
connectionis terminated after approximately an additional 11 minutes (9 probes an<br /> interval of
75seconds apart) when keep-alive is enabled.<br /><br /> Note that underlying connection tracking
mechanismsand application timeouts may be much shorter.<br /><br />Cheers,<br /><br />WBL<br /><br />