Re: How to close dead connections immediately

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andrus" <eetasoft(at)online(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to close dead connections immediately
Date: 2006-04-25 02:34:02
Message-ID: 8707.1145932442@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Andrus" <eetasoft(at)online(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2006-04-25 02:40:08 Re: How to have a blind-superuser
Previous Message Tom Lane 2006-04-25 02:18:51 Re: How to have a blind-superuser