Service tasks are executed multiple times

Hello All.

Maybe it is the known issue - I have multiple service tasks in process, which are supposed to be called one by one. The issue is, that some of them are called multiple times. To be more presize - I have 3 service tasks, first one is called 1 time, second one is called 3 times, third task is called 2 times(I can see it in debug). Simplified process looks so:

<startEvent id="start"/>

<sequenceFlow sourceRef="start" targetRef="firstServiceTask" />

<serviceTask id="firstServiceTask" name="First Service Task"
             flowable:delegateExpression="${firstJavaDelegateSpringBean}" />

<sequenceFlow sourceRef="firstServiceTask" targetRef="secondServiceTask" />

<serviceTask id="secondServiceTask" name="Second Service Task"
             flowable:delegateExpression="${secondJavaDelegateSpringBean}"/>

<sequenceFlow sourceRef="secondServiceTask" targetRef="thirdServiceTask"/>

<serviceTask id="thirdServiceTask" name="Schedule Auction Specification Event Action"
             flowable:delegateExpression="${thirdJavaDelegateSpringBean}"/>

<sequenceFlow sourceRef="thirdServiceTask" targetRef="end"/>

<endEvent id="end"/>

Have you ever faced similar behavior? how did you solve it for yourself?

Hi,

that is really strange. There are plenty of tests testing sequence flows. I would not expect such as behaviour with the default engine configuration. Could you share simple jUnit test for it please?

Regards
Martin

Hi,

Can it be due to service tasks throwing error(not logged properly) and executor retrying those service task?

Thank You,

Hey @arpit.agrawal,

Yes it can be due to the throwing of an error. The BPMN you provided doesn’t seem to show that a service task is marked as async. However, if it is and then an exception is thrown during the execution of the 2nd service task the transaction would be rollbacked and then the async executor would retry it again and the 1st service task would be executed again