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?
To understand why you see this exception, I recommend this section of the docs: https://docs.camunda.org/manual/7.9/user-guide/process-engine/transactions-in-processes/#optimistic-locking
To avoid the exceptions, I recommend to read this: https://docs.camunda.org/manual/7.9/user-guide/process-engine/transactions-in-processes/#asynchronous-continuations. 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.