4 Replies Latest reply on Mar 12, 2010 2:56 PM by Clebert Suconic

    ReaperThread bug ?

    Clebert Suconic Master

      I'm having an issue on HornetQ's integration on the application server, as I posted here:

       

      http://community.jboss.org/thread/149374?tstart=0

       

       

      I will basically copy what I had originally on the Hornetq's dev forum:

       

       

      It appears to be a bug:

       

       

      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 on the application server's SVN.