cancel
Showing results for 
Search instead for 
Did you mean: 

Subprocess does not terminate after the parent process was terminated by a timer event

frauke
Champ in-the-making
Champ in-the-making
Hi everybody.

I got a process containing a subprocess. The subprocess has a timer boundary event. After it was fired I would expect the subprocess to be terminated, but the user task inside the subprocess is still accessible.
The 'cancel activiti' flag of the timer is set to 'true'.

We are using Activiti 5.11.
Is it a known bug?
In the attachement I added the process definition.

Best regards
Frauke
9 REPLIES 9

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,
I have found similar subprocess with timer event in activiti tests:
org.activiti.engine.test.bpmn.event.timer.BoundaryTimerEventTest#testTimerOnNestingOfSubprocesses
Could you check your process definition with the jUnit test?

Regards
Martin

frauke
Champ in-the-making
Champ in-the-making
Hi Martin,

where do I get the test from?
It's not included in the Activiti download package.

Regards
Frauke

trademak
Star Contributor
Star Contributor

frauke
Champ in-the-making
Champ in-the-making
Hi everybody,

now I wrote several tests and I got the following solutions:
1. Timer is fired manually as in your example: works correctly!
2. Timer is fired by timeout (I added a sleep command longer that the timer duration) : Now the subprocess' task is still active
3. "normal execution" by completing the inner task: correct

No I suspect that I maybe defined the timer in an incorrect way. Please may you have a look at it?
I want it to fire after 2 seconds and interrupt the subprocess.
In the attachement find the bpmn and my tests.
<code>
    <boundaryEvent id="timer" attachedToRef="subProcess" cancelActivity="true">
      <timerEventDefinition>
        <timeDuration>PT2S</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
</code>

Thanks for your help!!
Frauke

trademak
Star Contributor
Star Contributor
When writing unit tests with jobs working with sleeps is not really convenient.
In our unit tests we disable the job executor and execute the job manually to make sure it's executed.
Your timer definition is correct. Please note that the job executor has a default wait time of 5 seconds, so it's possible that the job is executed after 5 seconds in stead of 2 seconds.

Best regards,

frauke
Champ in-the-making
Champ in-the-making
Hello Tijs,

ok, I tried to reproduce an error that we have in our system with that kind of situation in a process.
How can I make sure the subprocess is really canceled after the timer event fired? And that the inner task may not be executed anymore?

We had an error reported from a customer, and I am not sure where the problem could be.
After the subprocess should have been ended by the timer, an other user still could see the inner task of the subprocess.

Best regards
Frauke

jbarrez
Star Contributor
Star Contributor
"After the subprocess should have been ended by the timer, an other user still could see the inner task of the subprocess."

That sounds very odd! Maybe this user didnt refresh his task inbox for a while?

slaimankoeik
Champ in-the-making
Champ in-the-making
Hi everyone
I'm designing a workflow in BPMN 2.0,I've uploaded all the necessary files, in summary my workflow starts with a standard start event followed by a java service task which is bounded to a java class named test7, one more thing for java service task is having a boundary timer set for 1 second if fired the flow will submit to a script task which outputs a small text, if not fired flow will submit to another script task.

the problem is the boundary timer is not fired , even with job executor and AsyncExecutor are activated.
if anyone has an idea for this situation ?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Slaiman,

Try to add JobTestHelper.waitForJobExecutorToProcessAllJobs(this.activitiRule, 10000, 500); to your test.

Regards
Martin