On Wed, 2007-04-18 at 13:33 +0100, Richard Jones wrote:
> I just put a page on the wiki with some thoughts and possible ways of 
> debugging this, as it happens:
> 
> http://wiki.dspace.org/index.php/Idle_In_Transaction_Problem
> 
> If you can have a look at the results of the query that this page 
> suggests and post it to the list or the wiki, perhaps we can start to 
> tighten up the database connections.

Hmmm... in theory, whilst transactions can 'fail', they should always
rollback or commit. If we assume something really obscure isn't
happening for now, it leaves us with two possibilities:

1) The Context has dropped out of scope without being cleaned up

2) A thread is still executing, and is still using it's Context / transaction.

A few obvious things here spring to mind:

1) Check the logs for Exceptions - one being thrown without a finally
to clean up the Context would be a likely (if not only) suspect for a
Context being lost.

2) Launch Tomcat under JDK 1.5 with the JMX interface enabled, and
attach JConsole to it (JMX adds little overhead to the server, and you
don't need to attach JConsole until the problem arises). From JConsole,
you can see how many Threads Tomcat is currently using, what status
they are in and often a stack trace - so you can see where in the code
that Thread is being blocked.

(As an aside, we had a problem with a different application, where
sooner or later - and often sooner - Tomcat would suddenly grind to a
halt and stop serving requests. Using JConsole showed that the Threads
were all blocked (and increasing  in number with every request), and
the point at which most of them was blocked was in trying to obtain a
database connection from a custom built pool - and it actually came
back to a background thread that was trying to close unwanted
connections at the same time the business logic was trying to close the
same connection. Both Threads got hung up on each other, and everything
else blocked as the pool couldn't give new connections whilst the clean
up was in progress.)

Also note that JConsole has a button to force garbage collection - this
may help in determining if there are dangling Contexts. If they (and
therefore the transactions) disappear after forcing the garbage
collection, then something was dangling - although that wouldn't tell you why).

G

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to