pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Csaba Nagy <nagy@ecircle-ag.com>
To: John R Pierce <pierce@hogranch.com>
Cc: Postgres JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: "Idle in Transaction" revisited.
Date: Mon, 20 Sep 2004 18:19:01 +0200
Message-ID: <1095697141.3661.56.camel@localhost.localdomain> (raw)
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>
	<Pine.BSO.4.56.0409180219260.17711@leary.csoft.net>
	<0f7c01c49d96$cab9dc90$0200a8c0@hogranch.com>
	<1095670077.3661.47.camel@localhost.localdomain>
	<129801c49f29$d54263f0$0200a8c0@hogranch.com>

> 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.





view thread (28+ messages)  latest in thread

Message-ID: <1095697141.3661.56.camel@localhost.localdomain>
Permalink:  ../1095697141.3661.56.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1095697141.3661.56.camel@localhost.localdomain

 · 

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: nagy@ecircle-ag.com, pierce@hogranch.com
  Subject: Re: "Idle in Transaction" revisited.
  In-Reply-To: <1095697141.3661.56.camel@localhost.localdomain>
  References: <0dfb01c49d0e$5c61c1f0$0200a8c0@hogranch.com> <26344.1095464431@sss.pgh.pa.us> <0e3701c49d19$e8a90230$0200a8c0@hogranch.com> <Pine.BSO.4.56.0409180219260.17711@leary.csoft.net> <0f7c01c49d96$cab9dc90$0200a8c0@hogranch.com> <1095670077.3661.47.camel@localhost.localdomain> <129801c49f29$d54263f0$0200a8c0@hogranch.com> <1095697141.3661.56.camel@localhost.localdomain>

* 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