Thread: Connection Timeout ?

Connection Timeout ?

From
Stefan Loidl
Date:
Hi,

is there a connection timeout in postgres?
It seems to me that connections that are idle for about a day,
are closed automatically by the corresponding postmaster process
and the process exits.

I'm using Postgres 7.1.2.

Thanks,
Stefan

--
Stefan Loidl                    Phone:  +49 89 289-28882
Leibniz Supercomputing Center   Fax:    +49 89 2809460
Barer Str. 21                   mailto:loidl@lrz.de
80333 Munich, Germany           http://www.lrz.de

Re: Connection Timeout ?

From
Tom Lane
Date:
Stefan Loidl <Stefan.Loidl@lrz-muenchen.de> writes:
> is there a connection timeout in postgres?
> It seems to me that connections that are idle for about a day,
> are closed automatically by the corresponding postmaster process
> and the process exits.

No such mechanism in Postgres itself, but perhaps you are seeing the
effects of some timeout in your TCP stack.

(More usually, we get complaints from people who think there *should*
be a timeout ;-))

            regards, tom lane

Re: Connection Timeout ?

From
Stefan Loidl
Date:
Tom Lane wrote:
>
> Stefan Loidl <Stefan.Loidl@lrz-muenchen.de> writes:
> > is there a connection timeout in postgres?
> > It seems to me that connections that are idle for about a day,
> > are closed automatically by the corresponding postmaster process
> > and the process exits.
>
> No such mechanism in Postgres itself, but perhaps you are seeing the
> effects of some timeout in your TCP stack.

I've just got a connection to a database on the same host and
I'm starting the postmaster without '-i'.
So I don't think the TCP stack is involved in this case?
Any other ideas where the problem could be?

Besides, I'm testing the connection status with PQstatus(),
but it doesn't return CONNECTION_BAD (after the connection has
been closed) until the next query.
Is there a better way to test a connection?

Thanks,
Stefan

--
Stefan Loidl                    Phone:  +49 89 289-28882
Leibniz Supercomputing Center   Fax:    +49 89 2809460
Barer Str. 21                   mailto:loidl@lrz.de
80333 Munich, Germany           http://www.lrz.de