Skip site navigation (1) Skip section navigation (2)

Re: TCP keepalive support for libpq

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Tollef Fog Heen <tollef(dot)fog(dot)heen(at)collabora(dot)co(dot)uk>, Robert Haas <robertmhaas(at)gmail(dot)com>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Subject: Re: TCP keepalive support for libpq
Date: 2010-02-12 09:40:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
> <peter(dot)geoghegan86(at)gmail(dot)com> wrote:
>> Why hasn't libpq had keepalives for years?
> I guess that it's because keepalive doesn't work as expected
> in some cases. For example, if the network outage happens
> before a client sends some packets, keepalive doesn't work,
> then it would have to wait for a long time until it detects
> the outage. This is the specification of linux kernel. So
> a client should not have excessive expectations of keepalive,
> and should have another timeout like QueryTimeout of JDBC.

In my experience, the problems described are common when using libpq
over any sort of flaky connection, which I myself regularly do (not
just with Slony, but with a handheld wi-fi PDT application, where
libpq is used without any wrapper). The slony docs say it takes about
2 hours for the problem to correct itself, but I have found that it
may take a lot longer, perhaps because I have a hybrid Linux/Windows
Slony cluster.

> keepalive doesn't work,
> then it would have to wait for a long time until it detects
> the outage.

I'm not really sure what you mean. In this scenario, would it take as
long as it would have taken had keepalives not been used?

I strongly welcome anything that can ameliorate these problems, which
are probably not noticed by the majority of users, but are a real
inconvenience when they do arise.

Peter Geoghegan

In response to


pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2010-02-12 09:49:09
Subject: pgsql: Reduce the chatter to the log when starting a standby server.
Previous:From: Federico Di GregorioDate: 2010-02-12 09:38:54
Subject: Re: Confusion over Python drivers {license}

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group