pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Christian van der Leeden <lists@logicunited.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Transactions not idle but "idle in transaction" since
Date: Sat, 05 Jun 2004 12:36:01 +1200
Message-ID: <40C11571.6000908@opencloud.com> (raw)
In-Reply-To: <784661A0-B5FC-11D8-B4BC-000A95D7BFA4@logicunited.com>
References: <784661A0-B5FC-11D8-B4BC-000A95D7BFA4@logicunited.com>

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




view thread (2+ messages)

Message-ID: <40C11571.6000908@opencloud.com>
Permalink:  ../40C11571.6000908@opencloud.com/
Also on:    postgresql.org/message-id/40C11571.6000908@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, lists@logicunited.com
  Subject: Re: Transactions not idle but "idle in transaction" since
  In-Reply-To: <40C11571.6000908@opencloud.com>
  References: <784661A0-B5FC-11D8-B4BC-000A95D7BFA4@logicunited.com> <40C11571.6000908@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox