cancel
Showing results for 
Search instead for 
Did you mean: 

How to specify/increase termination timeout

suribabu
Champ in-the-making
Champ in-the-making
Hi,

I am new bee to Activiti BPM. When I am trying to start my process instance using

ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process1",map);

(this process includes many jobs run in parallel),
the process is getting terminated after 60 seconds without completing all my jobs. (see error msg belowSmiley Happy

org.activiti.engine.impl.jobexecutor.DefaultJobExecutor stopExecutingJobs
WARNING: Timeout during shutdown of job executor. The current running jobs could not end within 60 seconds after shutdown operation.


I did not set this time any where in config xml. If this is the default behavious, how can I change this?
Is there any parameter to increase this timeout ?
Please suggest.

Thanks in advance.

-Suri
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
(this process includes many jobs run in parallel),

What do you mean with this? Does it have a lot of timers? Does it have many async steps?

Can you reproduce the issue in an easy unit test?

suribabu
Champ in-the-making
Champ in-the-making
Hi jbarrez,

It doesn't have timers but it has many async steps.
Here is the serviceTask configuration:

<serviceTask id="servicetask1" name="Process SubProj List" activiti:expression="${ProcessSubProjects.processSubProjects(cardSubProject,execution)}"  activiti:async="true" activiti:exclusive="false">
     <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="CardSubProjectList" activiti:elementVariable="cardSubProject">
    </multiInstanceLoopCharacteristics>
</serviceTask>




Thanks,
Suri.

jbarrez
Star Contributor
Star Contributor
On what database are you running on? Does your database use table locks? Because that's the only reason I can quickly think of that would generate timeouts.

frederikherema1
Star Contributor
Star Contributor
If there are jobs with a duration that exceed that 60 seconds, these will be "killed" when the job-executor is requested to shut down and not finished within 60 seconds.

This is built in into the job executor. However, by extending and plugging in your own JobExecutor, you can later this behavior and have a longer wait-time or other behavior.

See src.main.java.org.activiti.engine.impl.jobexecutor.DefaultJobExecutor


protected void stopExecutingJobs() {
    stopJobAcquisitionThread();
   
    // Ask the thread pool to finish and exit
    threadPoolExecutor.shutdown();

    // Waits for 1 minute to finish all currently executing jobs
    try {
      if(!threadPoolExecutor.awaitTermination(60L, TimeUnit.SECONDS)) {
        log.log(Level.WARNING, "Timeout during shutdown of job executor. "
                + "The current running jobs could not end within 60 seconds after shutdown operation.");       
      }             
    } catch (InterruptedException e) {
      log.log(Level.WARNING, "Interrupted while shutting down the job executor. ", e);
    }

    threadPoolExecutor = null;
  }