Optimistic locking exception on trying to delete sub process from another sub process

Hello,

We have encountered the issue of receiving Optimistic Locking exception as we tried to delete a subprocess from another process.

Here is our environment settings:

Spring Boot: V2.1.2 RELEASE

Camunda BPM: v7.12.0

Camunda BPM Spring Boot Starter: v3.4.1

Database: Postgres v12

We have two Subprocesses namely Subprocess-1 and Subprocess-2. Subprocess-1 contains one user task, Subprocess-2 contains a timer and a service task. Subprocess-2 starts the timer when Subporcess-1 user task is assigned to a user. The issue we are facing is from time to time (not always), we’ve got Optimistic Locking exception when we tried to delete the running Subporcess-2 while completing Subprocess-1 user task.

Here is the code in Java Delegate implementation to delete the Subprocess-2


// Deleting the Subprocess -2

runtimeService.deleteProcessInstancesIfExists(processInstanceIds, "unassisgned user", true, true, false);

 

// Complete the Subprocess-1 user task

taskService.complete(userTask.getId());

Here is the error message we observed in the log:


org.camunda.bpm.engine.OptimisticLockingException:

ENGINE-03005 Execution of 'DELETE ExecutionEntity[f9a05d98-d0d1-11ea-a793-005056aeee74]' failed.

Entity was updated by another transaction concurrently.

Can you please let us know what might be the reason for the exception and how to fix it?

Thank you so much for your kind help in advance.

Hello, we have the similar issue and are eager to get answer. can someone reply to this please?

Thanks a lot!

Jason

I have attached the Bpmn model for the above issue.
subprocess-1.bpmn (2.1 KB) subProcess_2.bpmn (3.8 KB)

This forum is pretty good at replying back with solution or workaround or understanding pretty quickly. But it doesn’t seem to be true for this one.

We are have similar issue that would block us from releasing to PROD. And the release date is counting down. We become very anxious about this issue.

If more clarity to the original post needs to be made, please provide specific areas that are lacking. I hope the author can enhance the post.

Thank you for the help.

@Niall, can you please kindly help on this? Thanks.