Getting OptimisticLockingException

Hello everyone,

In the production code we are getting following warning when retrieving the tasks

ExceptionHandler                         : org.camunda.bpm.engine.OptimisticLockingException: ENGINE-03005 Execution of 'UPDATE VariableInstanceEntity[80187535-4ce9-11ec-be00-6a17de19f60b]' failed. Entity was updated by another transaction concurrently.
	at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.concurrentUpdateDbEntityException(EnginePersistenceLogger.java:136)
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.handleConcurrentModification(DbEntityManager.java:413)
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:356)
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:323)
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:295)
	at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:272)
	at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:188)
	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119)
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:72)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:70)
	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
	at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35)
	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
	at org.camunda.bpm.engine.impl.AbstractQuery.executeResult(AbstractQuery.java:160)
	at org.camunda.bpm.engine.impl.AbstractQuery.singleResult(AbstractQuery.java:136)
	at org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.getTaskById(TaskResourceImpl.java:255)
	at org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.getJsonTask(TaskResourceImpl.java:150)
	at org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.getTask(TaskResourceImpl.java:140)

Since it’s a warning, we are not sure if we should ignore it, or try to identify the root cause.

So my question is: If we can ignore this warning and it is something that happens in Camunda Engine under the hood and we don’t have control over it. Or we need to investigate further and try to find root cause, if so, then from what to start? Because we would expect that during task load operation no updates are being made into the database.

@Lyaman_Agabekova Does your process has parallel gateway or parallel multi instance activities?

We don’t have parallel gateways, we have Asynchronous Continuations in some service tasks. Here is how our process looks like

Attaching logs file as well logs.txt (2.5 KB)

Hi @Lyaman_Agabekova,

the non interrupting attached message boundary events on the first task spawn a parallel execution branch.

It depends on the result, if you can ignore it.

It could be the case, that two branches of the process (after a message was correlated) overwrite an existing variable accidentily. If the process state is as expected, you can ignore it.

Hope this helps, Ingo

Hi Ingo!

Thank you for the reply!
We are not sure why it happens when we are retrieving the task (in the logs we noticed that it occurs after execution of these TaskResourceImpl.getTaskById() or TaskRestServiceImpl.queryTasks(…) methods. Could the variable be updated during the task load?

Kind regards,
Laman.

Hi @Lyaman_Agabekova,

no.