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 9A655329E89 for ; Mon, 20 Sep 2004 17:20:29 +0100 (BST) 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 14582-06 for ; Mon, 20 Sep 2004 16:20:24 +0000 (GMT) Received: from webmail.muc.domeus.com (mail.ecircle.de [195.140.186.200]) by svr1.postgresql.org (Postfix) with ESMTP id 84802329E85 for ; Mon, 20 Sep 2004 17:20:23 +0100 (BST) Received: from deimos.muc.ecircle.de (deimos.muc.ecircle.de [192.168.1.4]) by webmail.muc.domeus.com (READY) with SMTP id 30488AE8; Mon, 20 Sep 2004 18:20:22 +0200 (CEST) Received: from [192.168.1.110] ([192.168.1.110]) by deimos.muc.ecircle.de with Microsoft SMTPSVC(5.0.2195.6713); Mon, 20 Sep 2004 18:20:31 +0200 Subject: Re: "Idle in Transaction" revisited. From: Csaba Nagy To: John R Pierce Cc: Postgres JDBC In-Reply-To: <129801c49f29$d54263f0$0200a8c0@hogranch.com> References: <0dfb01c49d0e$5c61c1f0$0200a8c0@hogranch.com> <26344.1095464431@sss.pgh.pa.us> <0e3701c49d19$e8a90230$0200a8c0@hogranch.com> <0f7c01c49d96$cab9dc90$0200a8c0@hogranch.com> <1095670077.3661.47.camel@localhost.localdomain> <129801c49f29$d54263f0$0200a8c0@hogranch.com> Content-Type: text/plain Message-Id: <1095697141.3661.56.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 20 Sep 2004 18:19:01 +0200 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 20 Sep 2004 16:20:31.0857 (UTC) FILETIME=[C01B3610:01C49F2D] 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: 200409/127 X-Sequence-Number: 11017 > Trouble is, with JDBC as its currently implemented, the instant you Commit() > or Rollback(), JDBC starts a new transaction automatically, since JDBC has > no explicit Begin(). If that thread then goes quiescent for an arbitrary > period of time (perhaps waiting for more messaging traffic, our apps are > message driven factory floor middleware things), this transaction remains > open. Our applications are characterized by bursts of frenetic activity > followed by long idle periods, quite unpredictably. > OK, now I got your problem. For this one I can't imagine other solution than fixing it on the DB side :-) Just as a side note: if you use a connection pool which is under your control, it still could prove useful to sort of "refresh" the connections from time to time by dropping connections which are in service for longer than a maximum time to live (say a few hours). This way you avoid possible problems with resource leakage which occasionally can happen. > in this particular case, the lock is to simply indicate there is an active > 'subscriber' to a messaging 'subject', if the app has exited any which ways, > by definition that 'subscriber' is no longer active, so yes, we want the > lock to go away. > Now this looks to me more like a "registry" than a lock. In any case, it could be replaced by some leasing scheme, where you place a record which expires after a specified amount of time, and the active process has to refresh it from time to time to keep it active. I'm just that against DB locks, the hit my back a few times... Cheers, Csaba.