Re: How to close dead connections immediately - Mailing list pgsql-general

From Tom Lane
Subject Re: How to close dead connections immediately
Date
Msg-id 8707.1145932442@sss.pgh.pa.us
Whole thread Raw
In response to How to close dead connections immediately  ("Andrus" <eetasoft@online.ee>)
List pgsql-general
"Andrus" <eetasoft@online.ee> writes:
> My ODBC client uses single connection to Postgres 8.1.3 server in W2K
> In case of TCP error it closes connection and re-opens it.
> ...
> Is it possible to force postgres to close dead connections immediately, not
> after 6 hours ?

PG *will* close the connection immediately if it receives any
notification of connection drop from the client.  If it's not seeing
one, that suggests something wrong in your network infrastructure.
I'd suggest fixing the problem rather than kluging the symptom.

You can reduce the TCP timeout settings if you are using PG 8.1 and an
operating system that supports it (I have no idea if Windows does or not).
I wouldn't recommend trying to make it "immediate" since then any
network instability breaks your application.  5 minutes or so might be
reasonable though.  As you've noticed, the default timeouts are usually
upwards of an hour.  (You should however ask yourself if you really know
more about TCP than the authors of the TCP specifications do.)

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to have a blind-superuser
Next
From: "Jim C. Nasby"
Date:
Subject: Re: How to have a blind-superuser