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

Re: Keep-alive support

From: Leandro Lucarella <llucarella(at)integratech(dot)com(dot)ar>
To: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
Cc: Tomasz Myrta <jasiek(at)klaster(dot)net>, pgsql-interfaces(at)postgresql(dot)org, libpqxx-general(at)gborg(dot)postgresql(dot)org
Subject: Re: Keep-alive support
Date: 2006-11-30 14:11:08
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-interfaces
Jeroen T. Vermeulen escribió:
> On Thu, November 30, 2006 03:31, Tomasz Myrta wrote:
>> I used keepalive the same way as you (reconfiguring socket directly) and
>> I don't remember libpq trying to reconnect itself. I think it's a
>> libpqxx's behaviour - I didn't use it, but it looks like it is called
>> "reactivation".
> That's right.  It's libpqxx, not libpq, that restores the connection.  (It
> couldn't really be any other way because libpq doesn't have enough
> information to know it's safe--you could be in the middle of a
> transaction, or you could be losing a temp table).  Automatic reactivation
> can also be disabled explicitly if you don't want it (or just *when* you
> don't want it--e.g. when you're working with temp tables).
> I do think that the long TCP timeouts are something that should be handled
> at the lower levels.  We can't really do real keepalives, I guess, simply
> because libpq is synchronous to the application.  But perhaps we could
> demand that the server at least acknowledge a request in some way within a
> particular time limit?  It'd have to be at the lowest level possible and
> as "cheap" as possible, so it doesn't break when the server is merely very
> busy.

Thanks all for your responses, but this is *not* a libpqxx issue, just 
because I'm doing the test using plain libpq. Anyways, I have a little 
more information about my problem and it's no libpq either =)

The problem is shown when the time between the wire is unplugged and the 
use of the connection is not long enough to let the keep-alive kill the 
connection. Then the connection becomes active and the TCP timers looks 
like go back to the defaults, because there is data in the socket queue 
to send. So it's an OS/TCP issue.

I don't see any way to control this without using an application-level 
keep-alive, so I appreciate any ideas and suggestions =)

Leandro Lucarella
Integratech S.A.

In response to


pgsql-hackers by date

Next:From: Stephen HarrisDate: 2006-11-30 14:11:30
Subject: Re: Shutting down a warm standby database in 8.2beta3
Previous:From: Peter EisentrautDate: 2006-11-30 13:43:24
Subject: Re: little anoyance with configure

pgsql-interfaces by date

Next:From: Leandro LucarellaDate: 2006-12-01 15:44:22
Subject: Re: Keep-alive support
Previous:From: Jeroen T. VermeulenDate: 2006-11-30 06:33:03
Subject: Re: Keep-alive support

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