Optimistic Locking Exception while using parallel multi instance service tasks in camunda

I have a use case where I have implemented a parallel multi-instance service task that makes a call to an API endpoint and stores a few values returned in the response for each iteration. The data is stored in the execution variable and is being updated by multiple threads concurrently during execution. This is causing Optimistic Locking exception. I have retries configured so no data is lost but is there a way I can prevent this exception from happening?

Hello @leya ,

this is a known problem. The best way (in my opinion) to prevent this is using the „async before“ option on the joining parallel gateway.

Hope this helps

Jonathan