1 Reply Latest reply on Jun 22, 2007 3:37 AM by Mark Little

    Transaction Timeout

    Pankaj Sodagam Newbie

      We are using JTA transaction implementation of JBoss in conjunction with Spring for transaction management. The TransactionManager is not throwing an exception when there is a timeout. Instead it just waits for the SQL completion, rollbacks the transaction, makes it inactive. But it does logs a warning message :).

      15:33:24,593 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=uoponlsodagam/53, Bran
      chQual=, localId=53] timed out. status=STATUS_ACTIVE

      Spring does throw an exception when it finds the transaction is inactive when we try to execute another SQL statement in the same call.

      Is there a reason for TransactionManager to not cancel any running operations and throw an exception on timeout? The worst case if there are any database blocks, a sql statement executing in the transaction stays active for ever, and executing thread waits in the control of the TransactionManager for that period time.

      I am not able to see any valid reason for this pattern whether the transactions are used with EJB, JMS, or JDBC. I am just throwing this out there to community to see if others have same opinion or disagreements.

        • 1. Re: Transaction Timeout
          Mark Little Master

          Which TM are you using? The old TM or JBossTS?

          Why should it throw an exception and to whom?

          The JTA and OTS simply say that if a transaction timeout goes off the transaction will be rolled back automatically. Most of the industry TMs I've come across over the years handle this with a separate thread by either marking the transaction as rollback-only at that point (the old TM) and waiting until the thread which created the transaction tries to terminate the transaction (and then forcing a roll back), or (the more common case) have the thread run periodically and do a rollback on the tx when the timeout expires.

          Are you expecting the act of rollback to go round and interrupt the thread that was associated with the TM?