AnsweredAssumed Answered

Multi-instance Task and ActivitiOptimisticLockingException

Question asked by razu on Feb 15, 2012
Latest reply on Sep 8, 2016 by xman-berlin
Hi,

I experience ActivitiOptimisticLockingException when 2 threads want to complete different instances of tasks from multi-instance User Task in the same time. Is looks like a bug or bad design for me. Please tell me which object is locked when completing instance of multi-instance User Task?


org.activiti.engine.ActivitiOptimisticLockingException: ByteArrayEntity[244] was updated by another transaction concurrently
   at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:435) ~[activiti-engine-5.8.jar:5.8]
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:348) ~[activiti-engine-5.8.jar:5.8]
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:147) ~[activiti-engine-5.8.jar:5.8]
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:103) ~[activiti-engine-5.8.jar:5.8]
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49) ~[activiti-engine-5.8.jar:5.8]
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42) ~[activiti-spring-5.8.jar:na]
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) ~[org.springframework.transaction-3.0.5.RELEASE.jar:3.0.5.RELEASE]
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40) ~[activiti-spring-5.8.jar:na]
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) ~[activiti-engine-5.8.jar:5.8]
   at org.activiti.engine.impl.RuntimeServiceImpl.setVariableLocal(RuntimeServiceImpl.java:119) ~[activiti-engine-5.8.jar:5.8]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_30]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_30]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_30]
   at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_30]
   at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229) ~[groovy-all-1.7.5.jar:1.7.5]
   at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52) ~[groovy-all-1.7.5.jar:1.7.5]
   at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:132) ~[groovy-all-1.7.5.jar:1.7.5]
   at com.example.MyService.completeTask(MyService.groovy:262) ~[MyService.class:na]

Outcomes