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 4748AD1B33D for ; Fri, 4 Jun 2004 21:33:43 -0300 (ADT) 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 06518-08 for ; Sat, 5 Jun 2004 00:33:41 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 14ED8D1B220 for ; Fri, 4 Jun 2004 21:33:37 -0300 (ADT) Received: from p11-max3.pmr.ihug.co.nz ([203.173.223.139] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1BWP7g-00023X-00; Sat, 05 Jun 2004 12:33:29 +1200 Message-ID: <40C11571.6000908@opencloud.com> Date: Sat, 05 Jun 2004 12:36:01 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christian van der Leeden Cc: pgsql-jdbc@postgresql.org Subject: Re: Transactions not idle but "idle in transaction" since References: <784661A0-B5FC-11D8-B4BC-000A95D7BFA4@logicunited.com> In-Reply-To: <784661A0-B5FC-11D8-B4BC-000A95D7BFA4@logicunited.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200406/19 X-Sequence-Number: 10221 Christian van der Leeden wrote: > Hi, > > I've upgraded the postgres system to 7.4.2 recently and switched > the JDBC driver to 7.4.213. Now all my transactions are always > "idle in transaction" instead of "idle" (when doing ps -U postgres). > I'm using WebObjects, which will set setAutocommit(true) while doing > selects and just setAutocommit(false) when doing insert/updates. > > Is the autocommit feature now implemented in the JDBC adaptor (and not > on the server side)? I couldn't find the logic of doing rollback/commits > on the client side after each expression in AbstractJdbc1Connection.java > (which comes with 7.4.2 distribution). 7.3 added a way to disable server-side autocommit; 7.4 removed it again. The default server behaviour is autocommit ON, so the JDBC driver does extra work to implement autocommit=off (it inserts BEGIN/COMMIT/ROLLBACK as needed). > I'm guessing that transactions being idle in transaction could be the cause > of my problem, that postgres is eating away virtual memory (on OSX10.3), > and I'd like to try to get all selects commited or rolled back... It's probably harmless; the driver does a "COMMIT;BEGIN" or "ROLLBACK;BEGIN" when committing or rolling back, so there always appears to be a transaction open. Of course it's also possible your app really IS leaving the transaction open -- that'd be an application bug. If you upgrade to the latest CVS driver this behaviour should go away (the BEGIN is delayed until the first query is run). -O