Thread: Remote connection timed out

Remote connection timed out

From
Barbara Stephenson
Date:
Hello,
We have a website that connects remotely to our  8.3 postgres database.  I've noticed if I connect to the database and let it sit for an hour the connection is lost.   Is there a default connection timeout? 
--
Regards,

Barbara Stephenson
EDI Specialist/Programmer
Turbo, division of OHL
2251 Jesse Jewell Pkwy
Gainesville, GA  30507
tel: (678)989-3020 fax: (404)935-6171
barbara@turbocorp.com
www.ohl.com

Re: Remote connection timed out

From
Steve Crawford
Date:
Barbara Stephenson wrote:
> Hello,
> We have a website that connects remotely to our  8.3 postgres
> database.  I've noticed if I connect to the database and let it sit
> for an hour the connection is lost.   Is there a default connection
> timeout?

How "remote"? Through firewalls/VPNs/etc.? My suspicion is that an
intervening portion of the network is dropping the connection. You could
start by analyzing your network. Alternately, the following portion of
postgresql.conf may help you (if these socket options are implemented on
your system).

# - TCP Keepalives -
# see 'man 7 tcp' for details

#tcp_keepalives_idle = 0                # TCP_KEEPIDLE, in seconds;
                                        # 0 selects the system default
#tcp_keepalives_interval = 0            # TCP_KEEPINTVL, in seconds;
                                        # 0 selects the system default
#tcp_keepalives_count = 0               # TCP_KEEPCNT;
                                        # 0 selects the system default

I believe the default for keepalives (at least on my Linux system at the
tcp-level)  is to wait 2-hours before sending keepalives. This may be
too long in your case.

Cheers,
Steve