Cannot complete task, Entity was updated by another transaction concurrently

Hey There, I am facing an issue where I am trying to complete a list of resolved task in a for loop via rest api, The issue goes like this:
Cannot complete task 68aadfb5-b329-11e8-acb3-0242ac120003: ENGINE-03005 Execution of 'UPDATE VariableInstanceEntity[68aa6b65-b329-11e8-acb3-0242ac120003]' failed. Entity was updated by another transaction concurrently.

where variable-instance/68aa6b65-b329-11e8-acb3-0242ac120003 is “nrOfCompletedInstances” of a multi instance activity (sub process)

Any ideas about how to solve this? Also, is there anything I need to change here?

Hi @vishwac,

To understand why you see this exception, I recommend this section of the docs:

To avoid the exceptions, I recommend to read this: In your case, you could try setting Multi Instance Asynchronous After on the multi instance task. Make sure the exclusive checkbox is ticked, to ensure that only one job is executed at a time.