X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0051D564E8 for ; Thu, 24 Feb 2005 05:14:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88778-05 for ; Thu, 24 Feb 2005 05:14:16 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id F269D5644B for ; Thu, 24 Feb 2005 05:12:15 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1D4BIE-0001NJ-00; Thu, 24 Feb 2005 18:12:06 +1300 Message-ID: <421D6222.500@opencloud.com> Date: Thu, 24 Feb 2005 18:12:02 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Sergei Georgiev Cc: pgsql-jdbc@postgresql.org Subject: Re: Socket timeouts (probably) References: In-Reply-To: X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/181 X-Sequence-Number: 12361 Sergei Georgiev wrote: > I have a really strange problem here. I've got two Fedora 2 machines - > one for the database and one for a Java application to be run. When a > transaction from the application is run against the database and the > network cable is unplugged (or the machine is shut down) the database > continues to hold the lock on the tables, which are used in the > transaction. The lock is released in about 10-12 minutes, which in my > case is not acceptable, because if another client starts a transaction > against these locked tables his UI ties his hands until the lock on > the tables is released and the transaction is complete. I raised this on -hackers recently. Ideally I'd like to see a transaction timeout implemented on the server side for exactly this case. See http://archives.postgresql.org/pgsql-hackers/2005-02/msg00397.php (the archive indexes seem to be broken at the moment, but the direct link works). You may want to try tweaking /proc/sys/net/ipv4/tcp_keepalive_* on the server to make TCP keepalives notice the dead connection faster (these are global settings, though). There are corresponding setsockopt() calls you could make on a per-socket basis if you are prepared to tweak the server code. -O