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.
<blockcode>
org.activiti.engine.ActivitiOptimisticLockingException: JobEntity [id=7617] was updated by another transaction concurrently
   at org.activiti.engine.impl.db.DbSqlSession$CheckedDeleteOperation.execute(DbSqlSession.java:286)
   at org.activiti.engine.impl.db.DbSqlSession.flushRegularDeletes(DbSqlSession.java:834)
   at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:798)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:595)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:211)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:137)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
   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.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:73)
</blockcode>

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.
<blockcode>
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(AtomicOperationTransitionCreateScope.java:35)
     at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:96)
     at org.activiti.engine.impl.jobexecutor.AsyncContinuationJobHandler.execute(AsyncContinuationJobHandler.java:35)
     at org.activiti.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:84)
     at org.activiti.engine.impl.persistence.entity.MessageEntity.execute(MessageEntity.java:29)
     at org.activiti.engine.impl.cmd.ExecuteAsyncJobCmd.execute(ExecuteAsyncJobCmd.java:52)
     at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
     at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
     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.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:73)
</blockcode>

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

Using:
  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

Outcomes