AnsweredAssumed Answered

Parallel Gateway:  Two Instances of UserTask are created mistakenly

Question asked by wl21st on Jun 24, 2015
Latest reply on Jul 28, 2015 by jbarrez
Hi All,

Attached the process definition.  I am working on a process POC which uses a parallel gateway/exclusive gateway, inclusive gateway, service tasks/user tasks and timerevent.  Strangely enough the two same user task(user task1) are created.  From debug, it seems that the Timer1 event has locking failure and and retried after 1 min.  Stacktrace in the job failure stacktrace.
org.activiti.engine.ActivitiOptimisticLockingException: JobEntity [id=7617] was updated by another transaction concurrently
   at org.activiti.engine.impl.db.DbSqlSession$CheckedDeleteOperation.execute(
   at org.activiti.engine.impl.db.DbSqlSession.flushRegularDeletes(
   at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(
   at org.activiti.engine.impl.db.DbSqlSession.flush(
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(
   at org.activiti.engine.impl.interceptor.CommandContext.close(
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(

The two instances of the UserTask_1 are the result of two executions of the Timer1.  And at the second time, there is following stacktrace.
java.lang.NullPointerException: while trying to invoke the method org.activiti.engine.impl.pvm.process.ActivityImpl.isScope() of a null object loaded from local variable 'activity'
     at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(
     at org.activiti.engine.impl.interceptor.CommandContext.performOperation(
     at org.activiti.engine.impl.jobexecutor.AsyncContinuationJobHandler.execute(
     at org.activiti.engine.impl.persistence.entity.JobEntity.execute(
     at org.activiti.engine.impl.persistence.entity.MessageEntity.execute(
     at org.activiti.engine.impl.cmd.ExecuteAsyncJobCmd.execute(
     at org.activiti.engine.impl.interceptor.CommandInvoker.execute(
     at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(
     at org.activiti.engine.impl.interceptor.LogInterceptor.execute(
     at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(
     at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(

When I tried to complete the two userTask1 instances, I got the exceptions and unable to complete any of them.

  1. Activiti 5.17.0 Async Job Executor and JBoss EAP 4.3 with JTA enabled environment.

Possible directions next steps:
    1. I am using StandaloneProcessEngineConfiguration(not JtaProcessEngineConfiguration).  Can this be related to the retry of jobs?
    2. Will the use async job executor related?  Will it be good chance to switch to non-async work?
    3. Process definition issue? 
    4. Issue in the engine side?
    5. others?

I have been working on this issue for a while and didn't get much progress of the root cause.  Any information will be very helpful and appreciated!

Sincerely yours,
Michael Luo