Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 9A1A59FB28D for ; Wed, 29 Nov 2006 16:32:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 57588-07 for ; Wed, 29 Nov 2006 16:31:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from bt2.jordan.pl (unknown [62.121.132.242]) by postgresql.org (Postfix) with ESMTP id B8C999FB28E for ; Wed, 29 Nov 2006 16:32:03 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by bt2.jordan.pl (Postfix) with ESMTP id C0A1919C004; Wed, 29 Nov 2006 21:32:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bt.jordan.pl Received: from bt2.jordan.pl ([127.0.0.1]) by localhost (bt2.jordan.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kZNWYqsDxPBU; Wed, 29 Nov 2006 21:31:57 +0100 (CET) Received: from [192.168.24.4] (adar112.neoplus.adsl.tpnet.pl [83.11.253.112]) by bt2.jordan.pl (Postfix) with ESMTP id D217E19C002; Wed, 29 Nov 2006 21:31:56 +0100 (CET) Message-ID: <456DEE3D.3020108@klaster.net> Date: Wed, 29 Nov 2006 21:31:57 +0100 From: Tomasz Myrta Organization: KLASTER User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: Leandro Lucarella Cc: pgsql-interfaces@postgresql.org Subject: Re: Keep-alive support References: <456DE433.8000407@integratech.com.ar> In-Reply-To: <456DE433.8000407@integratech.com.ar> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.459 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200611/17 X-Sequence-Number: 6332 Leandro Lucarella napisal 2006-11-29 20:49: > Is there any keep alive support in libpq? I'm not really using libpq > directly, I'm using libpqxx and there is no keep-alive support there, > so I'm trying to use TCP's own keep-alive support, but I have a > problem: libpq seems to reconnect the socket when the connection is lost. > In the sleep time I unplug the network cable and monitor the TCP > connection using netstat -pano, and found all the TCP keep-alive > timers times out perfectly, closing the connection, but inmediatly I > see a new connection (and without the keep-alive parameters, so it > take forever to timeout again). So I guess libpq is re-opening the > socket. This is making my life a nightmare =) 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". Regards, Tomasz Myrta