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(EnginePersistenceLogger.java:130)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.handleOptimisticLockingException(DbEntityManager.java:406)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:334)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:314)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:286)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:203)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:132)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:113)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)

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?

Best,
Nikola