org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction

Atlassian JIRA | Bryan Turner | 4 years ago
  1. 0

    During directory synchronization, if a batch is _processed successfully_ and then fails to be committed, it results in cascading rollback failures which completely block directory synchronization from that point forward. The most likely cause for commit failure is constraint violations. For example, if Crowd synchronizes down two groups whose names vary only by case, that can result in an exception similar to the following: {noformat} 2013-05-07 17:18:50,983 ERROR [scheduler_Worker-1] o.h.e.j.batch.internal.BatchingBatch HHH000315: Exception executing batch [integrity constraint violation: unique constraint or index violation: SYS_IDX_SYS_CT_10149_10151] 2013-05-07 17:18:50,996 WARN [scheduler_Worker-1] c.a.c.u.p.h.b.AbstractBatchProcessor batch failed falling back to individual processing org.springframework.dao.DataIntegrityViolationException: integrity constraint violation: unique constraint or index violation: SYS_IDX_SYS_CT_10149_10151; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: integrity constraint violation: unique constraint or index violation: SYS_IDX_SYS_CT_10149_10151 at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:138) ~[spring-orm-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:594) ~[spring-orm-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:476) ~[spring-orm-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) ~[spring-tx-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) ~[spring-tx-3.2.0.RELEASE.jar:3.2.0.RELEASE] at com.atlassian.stash.internal.crowd.TransactionManagerBatchProcessor.commitTransaction(TransactionManagerBatchProcessor.java:45) ~[stash-dao-impl-2.1.2.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.Hibernate4BatchProcessor.afterProcessBatch(Hibernate4BatchProcessor.java:31) ~[crowd-persistence-hibernate4-2.5.3-m1.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:160) [crowd-persistence-2.5.3-m1.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:121) [crowd-persistence-2.5.3-m1.jar:na] {noformat} Spring's {{TransactionManager}} _automatically_ rolls back the transaction in its exception handling for `AbstractPlatformTransactionManager.processCommit`. Before Crowd attempts to start processing individual rows, it first attempts to rollback the transaction. That results in a failure like this: {noformat} 2013-05-07 17:18:51,009 ERROR [scheduler_Worker-1] c.a.c.d.DbCachingDirectoryPoller Error occurred while refreshing the cache for directory [ 32770 ]. org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:817) ~[spring-tx-3.2.0.RELEASE.jar:3.2.0.RELEASE] at com.atlassian.stash.internal.crowd.TransactionManagerBatchProcessor.rollbackTransaction(TransactionManagerBatchProcessor.java:52) ~[stash-dao-impl-2.1.2.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.Hibernate4BatchProcessor.rollbackProcessBatch(Hibernate4BatchProcessor.java:74) ~[crowd-persistence-hibernate4-2.5.3-m1.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:166) ~[crowd-persistence-2.5.3-m1.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:121) ~[crowd-persistence-2.5.3-m1.jar:na] {noformat} The rollback failure is not handled by the batch processor, allowing it to propagate up the stack where it is handled by the Crowd {{DbCachingDirectoryPoller}} and terminates synchronization.

    Atlassian JIRA | 4 years ago | Bryan Turner
    org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction
  2. 0

    During directory synchronization, if a batch is _processed successfully_ and then fails to be committed, it results in cascading rollback failures which completely block directory synchronization from that point forward. The most likely cause for commit failure is constraint violations. For example, if Crowd synchronizes down two groups whose names vary only by case, that can result in an exception similar to the following: {noformat} 2013-05-07 17:18:50,983 ERROR [scheduler_Worker-1] o.h.e.j.batch.internal.BatchingBatch HHH000315: Exception executing batch [integrity constraint violation: unique constraint or index violation: SYS_IDX_SYS_CT_10149_10151] 2013-05-07 17:18:50,996 WARN [scheduler_Worker-1] c.a.c.u.p.h.b.AbstractBatchProcessor batch failed falling back to individual processing org.springframework.dao.DataIntegrityViolationException: integrity constraint violation: unique constraint or index violation: SYS_IDX_SYS_CT_10149_10151; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: integrity constraint violation: unique constraint or index violation: SYS_IDX_SYS_CT_10149_10151 at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:138) ~[spring-orm-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:594) ~[spring-orm-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:476) ~[spring-orm-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754) ~[spring-tx-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723) ~[spring-tx-3.2.0.RELEASE.jar:3.2.0.RELEASE] at com.atlassian.stash.internal.crowd.TransactionManagerBatchProcessor.commitTransaction(TransactionManagerBatchProcessor.java:45) ~[stash-dao-impl-2.1.2.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.Hibernate4BatchProcessor.afterProcessBatch(Hibernate4BatchProcessor.java:31) ~[crowd-persistence-hibernate4-2.5.3-m1.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:160) [crowd-persistence-2.5.3-m1.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:121) [crowd-persistence-2.5.3-m1.jar:na] {noformat} Spring's {{TransactionManager}} _automatically_ rolls back the transaction in its exception handling for `AbstractPlatformTransactionManager.processCommit`. Before Crowd attempts to start processing individual rows, it first attempts to rollback the transaction. That results in a failure like this: {noformat} 2013-05-07 17:18:51,009 ERROR [scheduler_Worker-1] c.a.c.d.DbCachingDirectoryPoller Error occurred while refreshing the cache for directory [ 32770 ]. org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:817) ~[spring-tx-3.2.0.RELEASE.jar:3.2.0.RELEASE] at com.atlassian.stash.internal.crowd.TransactionManagerBatchProcessor.rollbackTransaction(TransactionManagerBatchProcessor.java:52) ~[stash-dao-impl-2.1.2.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.Hibernate4BatchProcessor.rollbackProcessBatch(Hibernate4BatchProcessor.java:74) ~[crowd-persistence-hibernate4-2.5.3-m1.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:166) ~[crowd-persistence-2.5.3-m1.jar:na] at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:121) ~[crowd-persistence-2.5.3-m1.jar:na] {noformat} The rollback failure is not handled by the batch processor, allowing it to propagate up the stack where it is handled by the Crowd {{DbCachingDirectoryPoller}} and terminates synchronization.

    Atlassian JIRA | 4 years ago | Bryan Turner
    org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction
  3. 0

    JBPM 5.4 using custom class object as parameter in signal event

    Stack Overflow | 3 years ago | Ajay
    java.lang.RuntimeException: Could not commit session or rollback
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [CONF-10087] XWorkTransactionInterceptor commits transaction even when its marked as rollback only - Atlassian JIRA

    atlassian.com | 8 months ago
    org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction
  6. 0

    [BATCH-1307] MapJobRepository with multi-threaded parallel steps (split in job) - Spring JIRA

    spring.io | 1 year ago
    org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.transaction.IllegalTransactionStateException

      Transaction is already completed - do not call commit or rollback more than once per transaction

      at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback()
    2. Spring Tx
      AbstractPlatformTransactionManager.rollback
      1. org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:817)[spring-tx-3.2.0.RELEASE.jar:3.2.0.RELEASE]
      1 frame
    3. com.atlassian.stash
      TransactionManagerBatchProcessor.rollbackTransaction
      1. com.atlassian.stash.internal.crowd.TransactionManagerBatchProcessor.rollbackTransaction(TransactionManagerBatchProcessor.java:52)[stash-dao-impl-2.1.2.jar:na]
      1 frame
    4. com.atlassian.crowd
      AbstractBatchProcessor.execute
      1. com.atlassian.crowd.util.persistence.hibernate.batch.hibernate4.Hibernate4BatchProcessor.rollbackProcessBatch(Hibernate4BatchProcessor.java:74)[crowd-persistence-hibernate4-2.5.3-m1.jar:na]
      2. com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:166)[crowd-persistence-2.5.3-m1.jar:na]
      3. com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:121)[crowd-persistence-2.5.3-m1.jar:na]
      3 frames