AnsweredAssumed Answered

org.activiti.engine.ActivitiOptimisticLockingException: ProcessInstance[423472] was updated by another transaction concurrently

Question asked by jdp on Mar 3, 2016
Latest reply on Mar 28, 2016 by jdp
Hi,

I have a workflow designed as attached, when this workflow run in below mentioned steps, it is throwing  'org.activiti.engine.ActivitiOptimisticLockingException: ProcessInstance[423472] was updated by another transaction concurrently' error.

Step:
1. Tasks U1, S1, S2 are completed.
2. When system is going to complete U4, it calls S4 in same transaction.
3. During execution of S4, completion call for U2 is reached and trying to complete that task as well. So at this point activiti throws mentioned exception.

Trace :
        org.activiti.engine.ActivitiOptimisticLockingException: ProcessInstance[423472] was updated by another transaction concurrently
   at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:621)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:503)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:175)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:122)
   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:131)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
   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.TaskServiceImpl.complete(TaskServiceImpl.java:170)
         ……………


Can any one has any hints, how to solve the problem. I have resolved this problem by making same workflow instance calls in synch, but the solution does not work for environment which has multiple activiti engines running as these calls are coming from different activiti engines.

is there any way I can handle this situation other than making it in synch mode ?


JDP

Outcomes