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

OptimisticLockRetryInterceptor doesn't retry 3 times

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • jBPM 6.5.0.Final, 7.0.0.Final
    • Persistence
    • None

      OptimisticLockRetryInterceptor has "retries = 3" by default. When it exceeds the max retry, it gives up with the WARN message "Retry failed after 4 attempts".

      But actually, it retries only 2 times so the number of attempts is 3.

      The last sleepTime (800 ms) is just a sleep time before throwing an Exception.

      Attached a unit test for branch 6.5.x because JpaOptLockPersistentStatefulSessionTest in master doesn't seem to work now (DROOLS-1393).

      Running org.drools.persistence.session.JpaOptLockPersistentStatefulSessionTest
      2017-06-01 16:42:39,520 [main] |org.drools.persistence.TransactionManagerFactory| INFO  Using org.drools.persistence.jta.JtaTransactionManagerFactory@4a3be6a5
      2017-06-01 16:42:39,874 [pool-3-thread-1] |org.drools.persistence.jta.JtaTransactionManager| WARN  Unable to commit transaction
      bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback
      	...
      2017-06-01 16:42:39,875 [pool-3-thread-1] |org.drools.persistence.SingleSessionCommandService| WARN  Could not commit session
      java.lang.RuntimeException: Unable to commit transaction
      	...
      2017-06-01 16:42:39,876 [pool-3-thread-1] |org.drools.persistence.jpa.OptimisticLockRetryInterceptor| TRACE RuntimeException caught in OptimisticLockRetryInterceptor: Unable to commit transaction
      2017-06-01 16:42:39,876 [pool-3-thread-1] |org.drools.persistence.jpa.OptimisticLockRetryInterceptor| TRACE Command failed due to optimistic locking java.lang.RuntimeException: Unable to commit transaction waiting 50 millis before retry
      2017-06-01 16:42:39,928 [pool-3-thread-1] |org.drools.persistence.jpa.OptimisticLockRetryInterceptor| TRACE retrying (attempt 2)...
      2017-06-01 16:42:39,949 [pool-3-thread-1] |org.drools.persistence.jta.JtaTransactionManager| WARN  Unable to commit transaction
      bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback
      	...
      2017-06-01 16:42:39,949 [pool-3-thread-1] |org.drools.persistence.SingleSessionCommandService| WARN  Could not commit session
      java.lang.RuntimeException: Unable to commit transaction
      	...
      2017-06-01 16:42:39,950 [pool-3-thread-1] |org.drools.persistence.jpa.OptimisticLockRetryInterceptor| TRACE RuntimeException caught in OptimisticLockRetryInterceptor: Unable to commit transaction
      2017-06-01 16:42:39,950 [pool-3-thread-1] |org.drools.persistence.jpa.OptimisticLockRetryInterceptor| TRACE Command failed due to optimistic locking java.lang.RuntimeException: Unable to commit transaction waiting 200 millis before retry
      2017-06-01 16:42:40,150 [pool-3-thread-1] |org.drools.persistence.jpa.OptimisticLockRetryInterceptor| TRACE retrying (attempt 3)...
      2017-06-01 16:42:40,196 [pool-3-thread-1] |org.drools.persistence.jta.JtaTransactionManager| WARN  Unable to commit transaction
      bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback
      	...
      2017-06-01 16:42:40,198 [pool-3-thread-1] |org.drools.persistence.SingleSessionCommandService| WARN  Could not commit session
      java.lang.RuntimeException: Unable to commit transaction
      	...
      2017-06-01 16:42:40,200 [pool-3-thread-1] |org.drools.persistence.jpa.OptimisticLockRetryInterceptor| TRACE RuntimeException caught in OptimisticLockRetryInterceptor: Unable to commit transaction
      2017-06-01 16:42:40,200 [pool-3-thread-1] |org.drools.persistence.jpa.OptimisticLockRetryInterceptor| TRACE Command failed due to optimistic locking java.lang.RuntimeException: Unable to commit transaction waiting 800 millis before retry
      2017-06-01 16:42:41,001 [pool-3-thread-1] |org.drools.persistence.jpa.OptimisticLockRetryInterceptor| WARN  Retry failed after 4 attempts
      java.lang.RuntimeException: Unable to commit transaction
      	...
      
      Tests run: 2, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 3.844 sec <<< FAILURE! - in org.drools.persistence.session.JpaOptLockPersistentStatefulSessionTest
      testOptimisticLockInterceptorMaxRetry(org.drools.persistence.session.JpaOptLockPersistentStatefulSessionTest)  Time elapsed: 3.699 sec  <<< FAILURE!
      java.lang.AssertionError: expected:<4> but was:<3>
      	at org.junit.Assert.fail(Assert.java:88)
      	at org.junit.Assert.failNotEquals(Assert.java:834)
      	at org.junit.Assert.assertEquals(Assert.java:118)
      	at org.junit.Assert.assertEquals(Assert.java:144)
      	at org.drools.persistence.session.JpaOptLockPersistentStatefulSessionTest.testOptimisticLockInterceptorMaxRetry(JpaOptLockPersistentStatefulSessionTest.java:232)
      
      
      Results :
      
      Failed tests: 
        JpaOptLockPersistentStatefulSessionTest.testOptimisticLockInterceptorMaxRetry:232 expected:<4> but was:<3>
      

              swiderski.maciej Maciej Swiderski (Inactive)
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: