Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#354 ConnectionManager does not release connections if excepted

v3.0 Rabbit Hole
open
David Jencks
JBossCX (28)
5
2003-03-27
2003-02-10
David Croley
No

In the ConnectionManager (under 3.0.4), we have been
doing some integration with Toplink and I think that I
have found a bug in the JBoss code. The problem we are
seeing is that managed connections are not be released
when they should be.

In LocalTxConnectionManager.java, there is some code in
connectionClosed() method that looks like:

if (isManagedConnectionFree())
{
log.info("called unregisterAssociation, delisting");
//no more handles
delist();
log.info("called unregisterAssociation, returning");

returnManagedConnection(this.getManagedConnection(),
false);
}

The problem is that if there is an exception in the
delist() function call, the managed connection is never
released. This happens silently as the code only
catches ResourceExceptions, but some parent is catching
the exception that we are getting. By placing a
catch-all try clause around the delist(), I see that we
get...

java.lang.IllegalStateException: Already committed.

in some cases. We have fixed the problem for us by
simply reordering the statements so that the delist()
happens after the call to "returnManagedConnection()",
but a better solution might be to use a better
try-catch-finally clause.

Looks like this code has been rewritten in the 4.0RC's,
but it would be nice to fix this for the 3.x branch.

David Croley
dcroley@pav.com

Discussion

  • David Croley
    David Croley
    2003-02-10

    Logged In: YES
    user_id=709294

    might be related to bugs 580529, 620262, and 644496.

     
  • David Croley
    David Croley
    2003-02-20

    Patched LocalTxConnectionManager.java

     
  • David Jencks
    David Jencks
    2003-03-27

    • assigned_to: nobody --> d_jencks