AnsweredAssumed Answered

Instances hang with concurrency

Question asked by malizor on Jun 9, 2017
Latest reply on Jun 12, 2017 by daisuke-yoshimoto



I attached a simple .BPMN with which I managed to reliably reproduce my issue.


It only contains script tasks, though I originally noticed this behavior with Java service tasks.


There are 5 script tasks witch are all marked as async.
The first 4 do nothing and the fifth one sleeps for 2 minutes (in my experience, it works the same with any other service task that is "long to process").

What I observe when launching new instances is the following:

  • The first and second instances go through the workflow and wait on the wait_script
  • The third one stay on script1 for some seconds then goes to wait_script
  • The fourth one stay on script1 until the first two instances finish.

I also tried launching 100 instances of this same workflow at once.
In this case I observed that they are all processed very slowly. It seems the instances advanced by batches of around 20, in no particular order, and that they stayed on wait_script for more than 2 minutes.
All in all, the 100 instances needed about 20 minutes to complete.



Note that I tried to modifie the asyncExecutor settings but I did not notice any change.

I set the following settings:

<property name="jobExecutorActivate" value="false" />
<property name="asyncExecutorEnabled" value="true" />
<property name="asyncExecutorActivate" value="true" />


<bean id="asyncExecutor" class="org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor">
    <property name="corePoolSize" value="100" />
    <property name="maxPoolSize" value="2000" />
    <property name="keepAliveTime" value="3000000" />
    <property name="queueSize" value="20000" />
    <property name="maxTimerJobsPerAcquisition" value="2000" />
    <property name="maxAsyncJobsDuePerAcquisition" value="2000" />
    <property name="defaultAsyncJobAcquireWaitTimeInMillis" value="10000" />
    <property name="defaultTimerJobAcquireWaitTimeInMillis" value="10000" />
    <property name="timerLockTimeInMillis" value="60000" />
    <property name="asyncJobLockTimeInMillis" value="60000" />


I don't understand why instances seems to get stuck when other are being processed.

Why all my instances do not go directly at the wait_script step? Why can't they all process concurrently?

Note that it works fine if I unset all async flags, so it seems to me that this is related to the job executor.


What I concluded is that Activiti expects a job execution to be relatively short, but it's not a really satisfying answer.


I'm using Activiti 5.22 , deployed in Tomcat7 (process deployed in the explorer and launched via the REST API).