1 Reply Latest reply on Apr 7, 2006 7:25 AM by Claire Costello

    Dealing with "Rerun the transaction" errors

    Claire Costello Newbie

      Hi,

      JBoss version: 4.0.2
      JVM version: 1.5

      Basically, the code creates entity beans from messages received from a JMS queue. If certain messages arrive, extra activities have to be performed. The logic crosses some method and entity boundaries but these are not long running transactions.
      Would this affect the transactional status?
      Is that the reason "STATUS_NO_TRANSACTION" appears in the error message below?

      Everything goes fine (when processing 1 message/sec) except every now and then, the following deadlock scenario occurs:

      Error 1205 is produced which is an SQL Server error and is thrown up on JBoss output as follows:

      2006-03-21 09:58:42,406 ERROR [EventBean] - null; CausedByException is:
       Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=iwise/1272953, BranchQual=, localId=1272953] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: Store failed; CausedByException is:
       [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Transaction (Process ID 58) was deadlocked on {lock} resources with another process and has been chosen as the deadlock victim. Rerun the transaction.); - nested throwable: (org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=iwise/1272953, BranchQual=, localId=1272953] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: Store failed; CausedByException is:
       [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Transaction (Process ID 58) was deadlocked on {lock} resources with another process and has been chosen as the deadlock victim. Rerun the transaction.))
      

      I altered the SQL select template from xlock to nolock in conf\standardjbosscmp-jdbc.xml to contend with this issue, but the same error occurs at times.
      <name>MS SQLSERVER2000</name>
      <row-locking-template>SELECT ?1 FROM ?2 with (nolock) WHERE ?3 ORDER BY ?4</row-locking-template>
      

      Do I need to configure transaction timeouts to some higher value?
      Or is the problem with SQL server solely?
      Do I need to explicitly program transactions into my application code? Perhaps break up the code into smaller logical transactions where possible?

      If anyone can give me another hint to try to eliminate this problem, I would be very grateful.

      TIA,
      Claire.


        • 1. Re: Dealing with
          Claire Costello Newbie

          I've changed the page locking and row locking policies from within SQL Server to restrict locking to row locking only on the heavily used tables. I know this will cause SQL server to work harder.

          The app can deal with messages arriving at 1 per second, but on occasion it has deadlock.
          As a more general question: How can I scale up? Anyone got any suggestions?

          MTIA, Claire.