AnsweredAssumed Answered

Stopped process is still running

Question asked by suhaig on Jul 3, 2014
Latest reply on Jul 4, 2014 by suhaig

I have a very simple workflow with two Java service tasks. Both tasks are doing nothing, but waiting for 5 seconds. The first service task is asynchronous the second one is synchronous. There's an ExecutionListener attached to the end event of the process and of the service tasks too. There's a unit test, which starts an Activiti ProcessEngine, deploys the example workflow and executes it. The unit test waits 3 seconds after starting the workflow and then calls the deleteProcessInstance method of the RuntimeService. The ExecutionListener of the first service task gets called by Activiti, right before the calling of the ExecutionListener of the process. The assertProcessEnded method returns successfully. But the workflow is still running. After 5 seconds the second service task is started and after another 5 seconds the process ends normally. During the deleteProcessInstance call, Activiti calls the deleteTasksByProcessInstanceId method of TaskEntityManager, but this method does not find any tasks to delete. It seems that the JobExecutor does not check whether the process stopped or not. We are on Activiti version 5.13, but the same applies to version 5.15 too.

Here are some log messages:

10:39:57,604 [main] INFO  org.activiti.engine.impl.ProcessEngineImpl  - ProcessEngine default created
10:39:57,605 [main] INFO  org.activiti.engine.impl.jobexecutor.JobExecutor  - Starting up the JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor].
10:39:57,608 [Thread-1] INFO  org.activiti.engine.impl.jobexecutor.AcquireJobsRunnable  - JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor] starting to acquire jobs
10:39:57,626 [main] INFO  org.activiti.engine.impl.bpmn.deployer.BpmnDeployer  - Processing resource async.bpmn20.xml
10:39:58,027 [pool-1-thread-1] INFO  JavaServiceTask  - javaServiceTask servicetask1 started
10:40:01,014 [main] INFO  UnitTest  - calling deleteProcessInstance()
10:40:01,111 [main] INFO  JavaServiceTask  - javaServiceTask servicetask1 ended
10:40:01,114 [main] INFO  ProcessExecutionListener  - process ended
10:40:02,140 [main] INFO  org.activiti.engine.impl.jobexecutor.JobExecutor  - Shutting down the JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor].
10:40:02,141 [Thread-1] INFO  org.activiti.engine.impl.jobexecutor.AcquireJobsRunnable  - JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor] stopped job acquisition
10:40:03,028 [pool-1-thread-1] INFO  JavaServiceTask  - javaServiceTask servicetask1 stopped
10:40:03,029 [pool-1-thread-1] INFO  JavaServiceTask  - javaServiceTask servicetask1 ended
10:40:03,030 [pool-1-thread-1] INFO  JavaServiceTask  - javaServiceTask servicetask2 started
10:40:08,031 [pool-1-thread-1] INFO  JavaServiceTask  - javaServiceTask servicetask2 stopped
10:40:08,032 [pool-1-thread-1] INFO  JavaServiceTask  - javaServiceTask servicetask2 ended
10:40:08,034 [pool-1-thread-1] INFO  ProcessExecutionListener  - process ended

Can you help me with this?