Re: SO_KEEPALIVE

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: SO_KEEPALIVE
Date: 2005-05-16 22:08:08
Message-ID: 1116281289.4965.10.camel@fuji.krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On E, 2005-05-16 at 19:22 +0200, Dennis Bjorklund wrote:
> On Mon, 16 May 2005, Tom Lane wrote:
>
> > > How come we don't set SO_KEEPALIVE in libpq?
> > > Is there any reason why we wouldn't want it on?
> >
> > Is there any reason we *would* want it on? The server-side keepalive
> > should be sufficient to get whatever useful impact it might have.
>
> Wouldn't the client also want to know that the server is not there
> anymore? I talked to Gaetano Mendola (I think, but you never know on irc
> :-) and he had some clients that had been hanging around for 3 days after
> the server had been down and later up again (stuck in recv).

"stuck in recv" is symptom of a reconnect bug when libpq first tries to
test for a SSL connection but the connect has already gone away.
(search for "[HACKERS] oldish libpq bug still in RC2" in lists)
Tom fixed it in no time once I showed him where to look and provided a
test case. It should be fixed in 8.0.

I don't know if the fix was backported to older libpq versions as well.

> Server-side keepalive is enough for the server to clean up when clients
> disapears, but this do nothing to help clients detect that the server is
> gone. So I don't see what server side keepalive has to do with it.

--
Hannu Krosing <hannu(at)tm(dot)ee>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jason 2005-05-16 22:09:18 SQL99 hierarchical queries stalled
Previous Message Tom Lane 2005-05-16 21:30:52 Re: SQL Request Size