Problem asynchronous call activity in multi instance loop


It seems I have a problem. I don’t know if it’s a bug or a misunderstanding on my part.

I have a process in which I have a parallel multi instance loop fixed at 3 iterations (via loop cardinality).
in this loop I use a call activity. (see picture bellow)

The process that is called has only one service task in asynchronous before. (see bellow)

The problem is the loop is set to 3, my sub process is called 6 times (sometimes 4).

This problem is solved if the service task is either synchronous or the parallel multi instance is sequential.

Do you know what’s wrong?


So this is very likely due to the way that the multi-instance is re-synchronized with the process.
So - it’s possible that more than one thread want to complete it’s subprosses at the same time. Camunda will only let one thread be active on a single process instance in order to ensure consistency of state.
So - one of the threads is successful but he other one will be rolled back and then retry.

This can be fixed if you put an async before on the end-event. It will still rollback the transaction but it won’t re-run the code in the service task.

Thanks for the reactivity!
It works