ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: session leak in ibatis 2.0.8
Date Tue, 28 Dec 2004 15:54:21 GMT
> endTransaction after every query. 

YES!  It is by design that you have to GUARANTEE to call
endTransaction() if startTransaction() is called.  So make sure to
call it in a finally block.  Here's the example from the docs (again):

    try {
        sqlMap.startTransaction ();
         // .... do work
        sqlMap.commitTransaction ();
    } finally {
        sqlMap.endTransaction ();

Or, if you just call one of the work methods (queryForX, insert,
update, delete etc.), then iBATIS does this for you (i.e. you don't
call startTransaction()).

This is not a "leak" or a bug as described.


On Tue, 28 Dec 2004 14:55:35 +0100, Baldur Norddahl
<bbn-ibatis@inaphone.com> wrote:
> Hi,
> I have had alot of problems with orion lockups where I would get a ton
> of messages like:
> DriverManagerConnectionPoolConnection not closed, check your code!
> I have finally traced it to a session leak in ibatis. The first time a
> thread makes a query, ibatis will allocate a session for that thread.
> And then never release that session again unless you explicitly call
> endTransaction(). So if you have a system that regularly creates new
> threads, you will eventually run out of sessions.
> For now I have managed to work around this problem by making an
> endTransaction after every query. This simple change fixed all my lockup
> problems, and reduced the number of open database connections tremendiously.
> Another application that did not have problems with lockup, went from
> using 15+ database connections to 1. I suppose this is because now the
> connections actually get put back into the pool, instead of being
> claimed indefinitly by ibatis for all my threads.
> Baldur

View raw message