AnsweredAssumed Answered

Erros on Multiinstance Task

Question asked by jerome.actility on Sep 5, 2016
Latest reply on Sep 14, 2016 by jerome.actility
Hi,

I'm stuck with multi errors during multi instances task run.

- Wildfly server
- Activiti version : 5.21
- ManagedAsyncJobExecutor is used


14:23:05,864 INFO  [org.activiti.engine.impl.db.DbSqlSession] (default task-115) Upgrade needed: 52002 -> 52100. Looking for schema update resource for component 'identity'
14:23:05,864 INFO  [org.activiti.engine.impl.db.DbSqlSession] (default task-115) no schema resource org/activiti/db/upgrade/activiti.mysql.upgradestep.52002.to.52100.identity.sql for upgrade
14:23:05,868 INFO  [org.activiti.engine.impl.asyncexecutor.AbstractAsyncJobExecutor] (default task-115) Starting up the default async job executor [org.activiti.engine.impl.asyncexecutor.ManagedAsyncJobExecutor].
14:23:05,869 INFO  [org.activiti.engine.impl.asyncexecutor.ManagedAsyncJobExecutor] (default task-115) Creating thread pool queue of size 100
14:23:05,869 INFO  [org.activiti.engine.impl.asyncexecutor.ManagedAsyncJobExecutor] (default task-115) Creating executor service with corePoolSize 2, maxPoolSize 10 and keepAliveTime 5000
14:23:05,870 INFO  [org.activiti.engine.impl.asyncexecutor.AcquireTimerJobsRunnable] (Thread-137) starting to acquire async jobs due
14:23:05,870 INFO  [org.activiti.engine.impl.asyncexecutor.AcquireAsyncJobsDueRunnable] (Thread-138) starting to acquire async jobs due


The processes run are the folllowing. I need to process in parallel HTTP request + mail + wait from one side and from the other side, start a Workflow on the HTTP request to release the wait task. The request are send by a Java Delegate task that used EJB lookup.

[IMG]http://img4.hostingpics.net/pics/56015829WF.png[/IMG]

I have 4 annoying errors :

<h1>Null pointer exception</h1>
<blockcode>
Caused by: java.lang.NullPointerException
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:51)
at com.actility.thingpark.smp.bpm.activiti.ActivitiCommandContext.performOperation(ActivitiCommandContext.java:37)
… 94 more
</blockcode>

<h1>ActivitiLockingExeption on variable instance (from activiti engine or script task)</h1>

Same here :
https://forums.activiti.org/content/multi-instance-task-and-activitioptimisticlockingexception


09:10:58,983 INFO  [com.actility.thingpark.smp.control.ProcessHistoryService] (EE-ManagedThreadFactory-default-Thread-7) workflowProcessEndedPrivate end
09:10:58,992 INFO  [com.actility.thingpark.smp.control.ProcessStatusService] (EJB default - 10) onProcessEvent | process id: 45088, key: null, type: END
09:10:58,992 INFO  [com.actility.thingpark.smp.control.ProcessHistoryService] (EJB default - 10) workflowProcessEnded: null, 45088, success, null
09:10:58,996 SEVERE [com.actility.thingpark.smp.control.ActivitiService] (EJB default - 10) : org.activiti.engine.ActivitiOptimisticLockingException: HistoricVariableInstanceEntity[id=44717, name=nrOfActiveInstances, revision=3, type=integer, longValue=4, textValue=4] was updated by another transaction concurrently
   at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:880)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:619)
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212)
   at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)


or


16:58:00,093 INFO  [com.actility.thingpark.smp.control.ProcessHistoryService] (EE-ManagedThreadFactory-default-Thread-7) workflowProcessEnded: null, 43858, success, null
16:58:00,117 INFO  [com.actility.thingpark.smp.bpm.activiti.ActilityProcessEngineConfiguration] (EE-ManagedThreadFactory-default-Thread-7) Try to end workflow with processInstanceId: 43858/30331
16:58:00,118 INFO  [com.actility.thingpark.smp.bpm.activiti.ActilityProcessEngineConfiguration] (EE-ManagedThreadFactory-default-Thread-7) : org.activiti.engine.ActivitiOptimisticLockingException: HistoricVariableInstanceEntity[id=41594, name=log, revision=14, type=serializable, byteArrayValueId=41595] was updated by another transaction concurrently
   at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:880)
   at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:619)


or …

<h1>EJB lookup failed despite the Managed Executor Service</h1>


at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.executeJob(ExecuteAsyncRunnable.java:95)
   at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:50)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)
   at org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:250)
Caused by: java.lang.RuntimeException: lookup failed: java:global/ProcessHistoryService
   at com.actility.thingpark.activiti.ProgrammaticBeanLookup.lookup(ProgrammaticBeanLookup.java:55)
   at com.actility.thingpark.activiti.ProgrammaticBeanLookup.lookup(ProgrammaticBeanLookup.java:48)
   at com.actility.thingpark.smp.bpm.context.StateContext.flushState(StateContext.java:29)
   at jdk.nashorn.internal.scripts.Script$1905$\^eval\_.:program(<eval>:3)
   at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)


<h1>HTTP response received before wait task block</h1>
Currently, to avoid this error, i push the response to a blocking queue and every 10 seconds, i try to fire the signal to the waiting task.

Outcomes