Uploaded image for project: 'IronJacamar'
  1. IronJacamar
  2. JBJCA-1159

ConnectionListener leaked if TSR throws IllegalStateException

    Details

      Description

      When a connection is retrieved from the MCP, ironjacamar will register it to ongoing JTA transaction. However, if the ongoing TX is not 'active' anymore the connection is lost.

      The code of AbstractPool demonstrates the problem. The call to getLock will throw an exception if the current TX is not active anymore and the cl is not returned to the pool.

      This issue can be reproduced on AS7 by using any EJB that requires a tx and does something with a DB connection. Put a breakpoint in the code below after retrieving the connectionlistener, and then wait for the transaction to timeout. Once that's done, continue the thread. The connection is not release (can be seen in JMX)

      We have noticed this problem regularly during our performance tests.

       ConnectionListener cl = mcp.getConnection(subject, cri);
            if (trace)
               log.tracef("Got connection from pool tracked by transaction=%s tx=%s", cl, trackByTransaction);
      
            TransactionSynchronizationRegistry tsr = getTransactionSynchronizationRegistry();
            Lock lock = getLock();
            try
            {
               lock.lockInterruptibly();
            }
            catch (InterruptedException ie)
            {
               Thread.interrupted();
      
               throw new ResourceException(bundle.unableObtainLock(), ie);
            }
      

      It seems this issue was introduced by changes done for https://issues.jboss.org/browse/JBJCA-572

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jesper.pedersen Jesper Pedersen
                Reporter:
                janssk77 Koen Janssens
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: