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

Re: TCP keepalive support for libpq

From: daveg <daveg(at)sonic(dot)net>
To: Andrew Chernow <ac(at)esilo(dot)com>
Cc: Tollef Fog Heen <tollef(dot)fog(dot)heen(at)collabora(dot)co(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: TCP keepalive support for libpq
Date: 2010-02-10 21:08:58
Message-ID: 20100210210857.GK20472@sonic.net (view raw or flat)
Thread:
Lists: pgsql-hackers
On Tue, Feb 09, 2010 at 09:34:10AM -0500, Andrew Chernow wrote:
> Tollef Fog Heen wrote:
> >(please Cc me on replies, I am not subscribed)
> >
> >Hi,
> >
> >libpq currently does not use TCP keepalives.  This is a problem in our
> >case where we have some clients waiting for notifies and then the
> >connection is dropped on the server side.  The client never gets the FIN
> >and thinks the connection is up.  The attached patch unconditionally
> >adds keepalives.  I chose unconditionally as this is what the server
> >does.  We didn't need the ability to tune the timeouts, but that could
> >be added with reasonable ease.
> 
> ISTM that the default behavior should be keep alives disabled, as it is 
> now, and those wanting it can just set it in their apps:
> 
> setsockopt(PQsocket(conn), SOL_SOCKET, SO_KEEPALIVE, ...)

I disagree. I have clients who have problems with leftover client connections
due to server host failures. They do not write apps in C. For a non-default
change to be effective we would need to have all the client drivers, eg JDBC,
psycopg, DBD-DBI, and the apps like psql make changes to turn it on. Adding
this option as a non-default will not really help.

-dg
 

-- 
David Gould       daveg(at)sonic(dot)net      510 536 1443    510 282 0869
If simplicity worked, the world would be overrun with insects.

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-02-10 21:35:02
Subject: Re: [PATCH] Output configuration status after ./configure run.
Previous:From: Alvaro HerreraDate: 2010-02-10 20:30:22
Subject: Re: [PATCH] Output configuration status after ./configure run.

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