Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-5045

Wrong DB transaction handling in jbpm-test-coverage module when Timeout is used in tests

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • None
    • None
    • None
    • None
    • NEW
    • NEW

    Description

      When using timeout in JUnit test as is e.g. here [1], JUnit executes the test method in separate Thread. When handling database transactions in such test incorrectly, they can remain open and can cause various problems, e.g. deadlocks.

      Example:
      Currently in this test [1] this assert [2] fails. Because the method runs in separate thread, the transaction remains open with some readlocks on ProcessInstanceLog. Because the assert fails, JUnit interrupts the test method Thread and in After method, database connection is disposed so also database is dropped, because of create-drop Hibernate setting. But the table ProcessInstanceLog cannot be dropped, because there is still open transaction with locks on this table from other Thread.

      I will make PR for this.

      [1] https://github.com/droolsjbpm/jbpm/blob/master/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/TransactionsTest.java#L72
      [2] https://github.com/droolsjbpm/jbpm/blob/master/jbpm-test-coverage/src/test/java/org/jbpm/test/functional/TransactionsTest.java#L78

      Attachments

        Activity

          People

            tzimanyi@redhat.com Tibor Zimányi
            tzimanyi@redhat.com Tibor Zimányi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: