Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-8421

Transaction timeout in JBoss caused deadlock with spring transaction manager

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Won't Fix
    • 3.0.5
    • None
    • Transaction
    • None
    • true

    Description

      Deadlock scenario:

      1. Transaction started. At some point, jdbc connection allocated from poll and registered as transaction resource.
      2. After timeout event occured, JBoss try to rollback this transaction.
      3. In process of rolling back transaction, reaper process try to get lock on connection to do rollback and stopped at this point in waiting.
      4. Due to cancelling state of the transaction, exception is rised in main process of transaction.
      5. Spring catched this exception and invokes rollback to transaction.
      6. Inside jboss transaction manager there is synchronized method for making transaction abort, so this rollback invocation is waiting another thread to complete.
      7. At final: JBoss hold synchronized lock on abort method, but wait for releasing lock on connection. Main process hold lock on connection, but wait for releasing lock on abort method. Deadlock state.

      How this can be fixed:

      In method org.springframework.transaction.jta.JtaTransactionManager#doRollback you can check transaction state, and if it is already in state Status.STATUS_ROLLING_BACK - just do nothing.

      Attachments

        Activity

          People

            juergen.hoeller Juergen Hoeller
            sergeyastakhov Sergey Astakhov
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              3 years, 38 weeks, 1 day ago