Deleting a process instance causes an OptimisticLockingException error (because of runtimeService.deleteProcessInstance(...)).
Log:
OptimisticLockingException: ENGINE-03005 Execution of 'DELETE ExternalTaskEntity[2dcd983e-c961-11e9-aef4-0a58c0a83f07]' failed. Entity was updated by another transaction concurrently
You have configured History cleanup [[1]]
The execution of the History cleanup (execution of EverLivingJob) shouldn’t be affected and shouldn’t create OptimisticLockingException situation during the process deletion in my opinion.
Are you sure that the exception is caused by the provided code?
What is your setup (Camunda version, server, database)? Could you please attach the complete stack trace of the exception.
OptimisticLockingException: ENGINE-03005 Execution of 'DELETE ExternalTaskEntity[2dcd983e-c961-11e9-aef4-0a58c0a83f07]' failed. Entity was updated by another transaction concurrently.\n\tat org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.concurrentUpdateDbEntityException(EnginePersistenceLogger.java:134)
...
RuntimeServiceImpl.java:173)\n\tat com.tm.wg.scheduler.TmProcessTerminationScheduler.lambda$terminateProcess$0(TmProcessTerminationScheduler.java:33)\n\tat java.util.ArrayList.forEach(ArrayList.java:1257)\n\tat com.tsystems.tm.wg.scheduler.TmProcessTerminationScheduler.terminateProcess(TmProcessTerminationScheduler.java:31)
What is your setup (Camunda version, server, database)?
File with full stack trace (there are two logs here, because in our environment there are two pods of camunda microservice). They are separated by a space. logs.json (13.2 KB)