org.camunda.bpm.engine.OptimisticLockingException: ENGINE-03005

I have a workflow with 2 exclusive branches, one containing a async-before subprocess. All tasks are exclusive asyns-before service tasks. I try to write some tests for it and the test for the branch containing the subprocess always fails with:

org.camunda.bpm.engine.OptimisticLockingException: ENGINE-03005 Execution of ‘DELETE MessageEntity[3c855b4c-32b6-11e9-9069-8c16454d3b17]’ failed. Entity was updated by another transaction concurrently.
at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.concurrentUpdateDbEntityException(
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.handleOptimisticLockingException(
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(

From the log files is seems that the id (3c855b4c-32b6-11e9-9069-8c16454d3b17) belongs to the first service task that should be executed after subprocess.

I’m using postgresql test container and batch processing option is disabled.
Camunda: embedded, version 7.8
spring boot starter 2.3.0

Did anyone face the same issue? The problem seems to appear only in tests and only for the branch with subprocess.

Thank you!

Hi @mm222089,

Is there a reason why you have jdbcBatchProcessing disabled?

Also, can you provide your model, or at least an example that reproduces the problem so that it can be replicated?