Concurrency Issue

Dear All,

I have upto 10 parallel tasks to be created. When they are completed by users, facing deadlock/ optimistic locking exception. For a fix, for each manual task completion, before calling complete task method, putting synchronized(processInstanceId) to make sure that the tasks in same process instance wont be completed simultaneously. This has fixed the problem for me now and i am not facing any issues now. Is there any optimal way or existing solution for this??

Hi,

Optimistic locking exceptions are expected behaviors of the process engine because it uses optimistic locking to resolve synchronization problems. You can use asynchronous continuations to limit the amount of work that is rolled back in your process due to optimistic locking.

Deadlocks are not expected behavior. If you can create a simple test case that reproduces the problem (see the unit testing template), we are happy to look into it.

Cheers,
Thorben