pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: João Paulo Ribeiro <jp@mobicomp.com>
To: Sriram Dandapani <sdandapani@counterpane.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: idle in transaction
Date: Mon, 18 Sep 2006 17:50:54 +0100
Message-ID: <450ECE6E.2090401@mobicomp.com> (raw)
In-Reply-To: <6992E470F12A444BB787B5C937B9D4DF05DF1A7F@ca-mail1.cis.local>
References: <6992E470F12A444BB787B5C937B9D4DF05DF1A7F@ca-mail1.cis.local>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi.<br>
In a more generic way, you need to garantee 2 things:<br>
1) You always release your connections back to the pool.<br>
2) Any connection released must not have a valid transaction with
resources allocated.<br>
<br>
Its ok to have a connection in the pool with setautocommit(false), that
leads to "idle in connection", if the transaction is a new one and no
resources or lock have been made at the db.<br>
<br>
If you want now what is blocking your vaccum try this:<br>
<br>
SELECT pg_class.relname AS table, pg_database.datname AS database,
transaction, pid, mode, granted FROM pg_locks, pg_class, pg_database
WHERE pg_locks.relation = pg_class.oid AND pg_locks.database =
pg_database.oid order by pg_class.relname, pid;<br>
<br>
You will see in wich table the vaccum is waiting to acquire the lock
and wich process is holding it at the moment.<br>
<br>
Best regards.<br>
Jo&atilde;o Paulo Ribeiro<br>
<br>
Sriram Dandapani wrote:
<blockquote
 cite="mid6992E470F12A444BB787B5C937B9D4DF05DF1A7F@ca-mail1.cis.local"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName">
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
  <style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";
	color:black;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
pre
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";
	color:black;}
span.EmailStyle17
	{mso-style-type:personal;
	font-family:Arial;
	color:windowtext;}
span.EmailStyle19
	{mso-style-type:personal-reply;
	font-family:Arial;
	color:navy;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
  </style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
  </o:SmartTagType>
  <div class="Section1">
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Hi<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">I use JBOSS
4.0.3 to manage my connection
pooling. Is there a way to configure / modify code to take care of this<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Thanks for
your input<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Sriram<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><o:p>&nbsp;</o:p></span></font></p>
  <div>
  <div class="MsoNormal" style="text-align: center;" align="center"><font
 color="black" face="Times New Roman" size="3"><span
 style="font-size: 12pt; color: windowtext;">
  <hr tabindex="-1" align="center" size="3" width="100%"></span></font></div>
  <p class="MsoNormal"><b><font color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext; font-weight: bold;">From:</span></font></b><font
 color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext;"> Jo&atilde;o
Paulo Ribeiro [<a class="moz-txt-link-freetext" href="mailto:jp@mobicomp.com">mailto:jp@mobicomp.com</a>] <br>
  <b><span style="font-weight: bold;">Sent:</span></b> Monday,
September 18, 2006
2:15 AM<br>
  <b><span style="font-weight: bold;">To:</span></b> Sriram Dandapani<br>
  <b><span style="font-weight: bold;">Cc:</span></b> <st1:PersonName
 w:st="on"><a class="moz-txt-link-abbreviated" href="mailto:pgsql-jdbc@postgresql.org">pgsql-jdbc@postgresql.org</a></st1:PersonName><br>
  <b><span style="font-weight: bold;">Subject:</span></b> Re: [JDBC]
idle in
transaction</span></font><font color="black"><span
 style="color: windowtext;"><o:p></o:p></span></font></p>
  </div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">Hi.<br>
  <br>
Are you using DODS/Enhydra to manage your database connection pool?<br>
If yes, see my email in the Enhydra mailing list:<br>
  <a href="http://mail-archive.objectweb.org/dods/2006-05/msg00000.html">http://mail-archive.objectweb.o...;
  <a href="http://mail-archive.objectweb.org/dods/2006-06/msg00000.html">http://mail-archive.objectweb.o...;
  <br>
The latest DODS dont have this issue anymore. You just use
"RollbackOnReset" option.<br>
  <br>
Bests regards.<br>
Jo&atilde;o Paulo Ribeiro<br>
  <br>
Sriram Dandapani wrote: <o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I use postgres 8.1.2
database and postgres 8.1.404
jdbc driver .<u1:p></u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><u1:p>&nbsp;</u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I keep seeing &#8220;idle in
transaction&#8221;
connections on the postgres box all the time. The application logic
closes all
connections , so it makes me wonder if the driver is issuing a begin
statement
after every commit to leave a floating transaction open.<u1:p></u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><u1:p>&nbsp;</u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">This is causing
autovacuum to not finish (and hence I
have to frequently issue database-wide vacuums to prevent the
transaction id
wraparound problem)<u1:p></u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><u1:p>&nbsp;</u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Any help here is
appreciated<u1:p></u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><u1:p>&nbsp;</u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Thanks<u1:p></u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><u1:p>&nbsp;</u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Sriram<u1:p></u1:p></span></font><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><br>
  <br>
  <br>
  <o:p></o:p></span></font></p>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">-- <o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">Jo&atilde;o Paulo Ribeiro | Senior Software Engineer<o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><a href="mailto:jp@mobicomp.com">jp@mobicomp.com</a><o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><o:p>&nbsp;</o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">PHONE: + 351 253 305 250<o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">FAX&nbsp; : + 351 253 305 250<o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><a href="http://www.mobicomp.com">www.mobicomp.com</a><o:p></o:p></span></f...;
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><o:p>&nbsp;</o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">________________________________________________________________<o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><o:p>&nbsp;</o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">About Solutions | Wireless World<o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><o:p>&nbsp;</o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">CONFIDENTIALITY NOTICE: This message, as well as existing attached files, is confidential and intended exclusively for the individual(s) named as addressees. If you are not the intended recipient, you are kindly requested not to make any use whatsoever of its contents and to proceed to the destruction of the message, thereby notifying the sender.<o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">DISCLAIMER: The sender of this message can not ensure the security of its electronic transmission and consequently does not accept liability for any fact which may interfere with the integrity of its content.<o:p></o:p></span></font></pre>
  </div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Jo&atilde;o Paulo Ribeiro | Senior Software Engineer
<a class="moz-txt-link-abbreviated" href="mailto:jp@mobicomp.com">jp@mobicomp.com</a>

PHONE: + 351 253 305 250
FAX  : + 351 253 305 250
<a class="moz-txt-link-abbreviated" href="http://www.mobicomp.com">www.mobicomp.com</a;

________________________________________________________________

About Solutions | Wireless World

CONFIDENTIALITY NOTICE: This message, as well as existing attached files, is confidential and intended exclusively for the individual(s) named as addressees. If you are not the intended recipient, you are kindly requested not to make any use whatsoever of its contents and to proceed to the destruction of the message, thereby notifying the sender.
DISCLAIMER: The sender of this message can not ensure the security of its electronic transmission and consequently does not accept liability for any fact which may interfere with the integrity of its content.</pre>
</body>
</html>



view thread (21+ messages)  latest in thread

Message-ID: <450ECE6E.2090401@mobicomp.com>
Permalink:  ../450ECE6E.2090401@mobicomp.com/
Also on:    postgresql.org/message-id/450ECE6E.2090401@mobicomp.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: jp@mobicomp.com, sdandapani@counterpane.com
  Subject: Re: idle in transaction
  In-Reply-To: <450ECE6E.2090401@mobicomp.com>
  References: <6992E470F12A444BB787B5C937B9D4DF05DF1A7F@ca-mail1.cis.local> <450ECE6E.2090401@mobicomp.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