Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WOSQh-0005fL-2p for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Mar 2014 13:45:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WOSQg-0005Hq-IH for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Mar 2014 13:45:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WOSQe-0005Hh-JW for pgsql-bugs@postgresql.org; Fri, 14 Mar 2014 13:45:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WOSQO-0002Ri-3u for pgsql-bugs@postgresql.org; Fri, 14 Mar 2014 13:45:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s2EDjMS5003111; Fri, 14 Mar 2014 09:45:22 -0400 From: Tom Lane To: Robert Voinea cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5465: dblink TCP connection hangs blocking translation from being terminated In-reply-to: <10183969.312fJvI1H2@shu> References: <10183969.312fJvI1H2@shu> Comments: In-reply-to Robert Voinea message dated "Fri, 14 Mar 2014 10:30:11 +0200" Date: Fri, 14 Mar 2014 09:45:22 -0400 Message-ID: <3110.1394804722@sss.pgh.pa.us> X-Pg-Spam-Score: -0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Robert Voinea writes: > In our setup, we make use extensively of dblink. > Due to the fact that some queries take some time to complete and that the link > is over the internet, sometime the server process (the transaction that runs > the dblink queries) hangs when the link goes down, keeping locks on several > records plus some advisory locks and thus freezing the whole (most of) the > database. > What I have found is this bug, that is remarkably similar (if not identical) > with what we are experiencing. > http://postgresql.1045698.n5.nabble.com/BUG-5465-dblink-TCP-connection-hangs-blocking-translation-from-being-terminated-td2132419.html#a2132420 That does not sound like a Postgres bug to me. What you are unhappy about is that the kernel isn't timing out a lost TCP connection more quickly. The default timeout is long (>1 hour probably), but that's required by Internet standards. The appropriate fix for this is to use aggressive keepalive parameters on the connection. You can set libpq's keepalive parameters in the connection string given to dblink. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs