3 Replies Latest reply: Mar 12, 2010 5:26 PM by Clebert Suconic RSS

    Bug on the Transaction Manager

    Clebert Suconic Master

      I have here what appears to be a bug on the transaction manager.

       

       

      I have my user transaction (javaee user transaction) setting the timeout to 5 seconds:

       

       

               UserTransaction ut = sessionCtx.getUserTransaction();

               ut.setTransactionTimeout(5);

               ut.begin();

      My test is doing some things and waiting 10 seconds:
                    
                     log.info("Received first message!");
                     log.info("Waiting 10 seconds now!");
                     try
                     {
                        Thread.sleep(10000);
                     }
                     catch (InterruptedException ignored)
                     {
                     }
      For some reason, the transaction is finishing ok.
      I debugged this and HornetQRAXAresource is receiving and end(...Success).
      The reaper thread on the Transaction manager is calling TransactionReapper.doCancellations...
      a few calls later, XAResourceRecord.topLevelAbort will call this:
                          try
                          {
                               if (!_prepared)
                               {
                                    if (endAssociation())
                                    {
                                         _theXAResource.end(_tranID, XAResource.TMSUCCESS);
                                    }
                               }
                          }
      
       
       
      
      

       

       

       

      The only reason this is working with the current resource adapter is because the resource adapter is checking for the status on the userTransaction object on every operation. But the TransactionManager should call the proper end here with the abort status IMO.

       

       

      This could be replicated by the test org.jboss.test.jca.test.TransactionActiveUnitTestCase on the HornetQ integration branch.