AnsweredAssumed Answered

Back to back Service task doesn't work

Question asked by ami on May 9, 2017
Latest reply on May 11, 2017 by gdharley

Hi,

 

We have a design like One Service Task is followed by next Service Task. Here it throws below error when the second Service task is initiated:

 

 

2017-05-09 15:50:16,341 DEBUG [org.activiti.engine.impl.db.DbSqlSession] (pool-5-thread-2) executing: delete ConcurrentExecution[2119210]
2017-05-09 15:50:16,342 DEBUG [org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution] (pool-5-thread-2) ooo Using Connection [Transaction-aware proxy for target Connection [jdbc:jtds:sqlserver://indiadev02;DatabaseName=awomdb;SelectMethod=Cursor, UserName=dmsdb, jTDS Type 4 JDBC Driver for MS SQL Server and Sybase]]
2017-05-09 15:50:16,342 DEBUG [org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution] (pool-5-thread-2) ==> Preparing: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ?
2017-05-09 15:50:16,342 DEBUG [org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution] (pool-5-thread-2) ==> Parameters: 2119210(String), 3(Integer)
2017-05-09 15:50:16,344 DEBUG [org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution] (pool-5-thread-2) <== Updates: 0
2017-05-09 15:50:16,344 DEBUG [org.activiti.engine.impl.interceptor.CommandContext] (pool-5-thread-2) Optimistic locking exception : org.activiti.engine.ActivitiOptimisticLockingException: ConcurrentExecution[2119210] was updated by another transaction concurrently
2017-05-09 15:50:16,344 DEBUG [org.springframework.jdbc.datasource.DataSourceTransactionManager] (pool-5-thread-2) Participating in existing transaction
2017-05-09 15:50:16,346 DEBUG [org.apache.ibatis.transaction.managed.ManagedTransaction] (pool-5-thread-2) Closing JDBC Connection [Transaction-aware proxy for target Connection [jdbc:jtds:sqlserver://indiadev02;DatabaseName=awomdb;SelectMethod=Cursor, UserName=dmsdb, jTDS Type 4 JDBC Driver for MS SQL Server and Sybase]]
2017-05-09 15:50:16,346 DEBUG [org.springframework.transaction.support.TransactionTemplate] (pool-5-thread-2) Initiating transaction rollback on application exception: org.activiti.engine.ActivitiOptimisticLockingException: ConcurrentExecution[2119210] was updated by another transaction concurrently
at org.activiti.engine.impl.db.DbSqlSession$CheckedDeleteOperation.execute(DbSqlSession.java:273)
at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:647)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:504)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:182)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:128)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

------------------------------------------------------------------------------------------------------------------

 

2017-05-09 15:50:16,353 ERROR [org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable] (pool-5-thread-2) exception during job execution: ConcurrentExecution[2119210] was updated by another transaction concurrently: org.activiti.engine.ActivitiOptimisticLockingException: ConcurrentExecution[2119210] was updated by another transaction concurrently
at org.activiti.engine.impl.db.DbSqlSession$CheckedDeleteOperation.execute(DbSqlSession.java:273)
at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:647)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:504)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:182)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:128)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

 

 

NOTE: We have used Locking mechanism to ensure there are no concurrent threads running, which works pretty well-one after another.

 

But the problem I find here is: Transaction !! Transaction is not committed somehow I think, but need solution to make it work. Any help will be appreciated.

 

Thanks,

Ami

Outcomes