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 AD3433A41CB for ; Mon, 22 Nov 2004 06:19:41 +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 92630-07 for ; Mon, 22 Nov 2004 06:19:39 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 757863A41C9 for ; Mon, 22 Nov 2004 06:19:35 +0000 (GMT) Received: (qmail 11970 invoked by uid 1112); 22 Nov 2004 06:20:21 -0000 Date: Mon, 22 Nov 2004 01:20:21 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Temp02 Cc: pgsql-jdbc@postgresql.org Subject: Re: Can't throw the dreaded 'idle in transaction' - need In-Reply-To: <02fe01c4d054$b60a5fe0$2201010a@bluereef.local> Message-ID: References: <02fe01c4d054$b60a5fe0$2201010a@bluereef.local> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/166 X-Sequence-Number: 11588 On Mon, 22 Nov 2004, Temp02 wrote: > 2. Is the idle in transaction a "normal" event for all update > transactions? Should the database release the lock immediately after the > commit, in all instances? Should we assume that when we see an 'idle in > transaction' that some error event has occurred that we're not seeing, > like a failed query etc, that's causing the connection to remain open? Idle in transaction is a normal state for every transaction that is not run in autocommit mode. When the first statement is run a transaction is started. When this statement completes the connection is "idle in transaction". It stays this way until the next statement is run, such that the transaction is no longer idle, or the transaction is ended by either a commit or rollback. > 3. We've tried to reduce all large transactions and complex queries > effectively to small transaction 'blocks' or simply leave auto.commit to > true and issue only single line updates. But this hasn't helped. Potential problems could be error handling code that bails out leaving the connection and transaction still in the idle-in-transaction state. Another problem in a multi-threaded multi-connection application is a deadlock involving both database and application resources. A deadlock in the database will be detected and broken, but the database doesn't know anything about locking code in the application. Kris Jurka