Optimistic Locking Exception when running 2-3 concurrent process instances

Hi @thorben,
Need your help to fix this issue.

Please look into it once.

Thanks,
Ruchira

Hi All,
can you please help us solving the optimistic locking isssue
We are facing this even while creating 2-3 camunda workflow instances, we are using MS SQL as the backend

Regards
Krishna

We are using MSSQL Server, with default configuration.
The ProcessEngine has the configuration with history = full , schemaUpdate = true, maxActiveConnections = 500

When 2 or more concurrent process instances try to update the workflow context, we get this error. What I mean is that these process instances are managing the variables of the same service task and the same process definition, but a different process instance. Each process instance has separate workflow context object. We had just 2 service task in a process where this error happens. If I remove making any changes to the workflow context , then this error does not come.

Stack trace
Exception in thread “Thread-3” org.camunda.bpm.engine.OptimisticLockingException: ENGINE-03005 Execution of ‘UPDATE VariableInstanceEntity[96469]’ failed. Entity was updated by another transaction concurrently.

  •    at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.concurrentUpdateDbEntityException(EnginePersistenceLogger.java:132)*
    
  •    at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.handleOptimisticLockingException(DbEntityManager.java:484)*
    
  •    at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.checkFlushResults(DbEntityManager.java:443)*
    
  •    at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:360)*
    
  •    at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:318)*
    
  •    at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:290)*
    
  •    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.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)*
    
  •    at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)*
    
  •    at org.camunda.bpm.engine.impl.RuntimeServiceImpl.getVariablesTyped(RuntimeServiceImpl.java:271)*
    
  •    at org.camunda.bpm.engine.impl.RuntimeServiceImpl.getVariablesTyped(RuntimeServiceImpl.java:266)*
    
  •    at org.camunda.bpm.engine.impl.RuntimeServiceImpl.getVariables(RuntimeServiceImpl.java:261)*
    
  •    at org.camunda.bpm.engine.impl.RuntimeServiceImpl.getVariables(RuntimeServiceImpl.java:76)*
    
  •    at com.walmart.drs.common.workflow.helper.WorkflowEngineHelper.getWorkflowContext(WorkflowEngineHelper.java:225)*
    
  •    at com.walmart.drs.common.workflow.engine.WorkflowEngineImpl.getWorkflowContext(WorkflowEngineImpl.java:146)*
    
  •    at com.walmart.drs.warp.services.order.service.WorkflowService.getDrivingObj(WorkflowService.java:117)*
    
  •    at com.walmart.drs.warp.services.order.service.CarrierIntegrationService.proceedAsync(CarrierIntegrationService.java:31)*
    
  •    at com.walmart.drs.warp.services.order.kafka.KafkaPoller.processKafkaMessage(KafkaPoller.java:83)*
    
  •    at com.walmart.drs.warp.services.order.kafka.KafkaPoller.runSingleWorker(KafkaPoller.java:72)*
    
  •    at com.walmart.drs.warp.services.order.kafka.KafkaThread.lambda$new$0(KafkaThread.java:24)*
    

** at java.lang.Thread.run(Thread.java:748)*

Please give us these configuration details.
Also - upload your process
describe your setup - application server? spring boot? clustered?

Hi Niall,

Its an MSSQL DB Single DB Instance. We have a spring boot service non-clustered using IBatis Connection to the Process Engine.
For Load testing, we used a simple process with just 4 service tasks.

Hi @r00k,

have a look at the docs about configuring the MS SQL Server: https://docs.camunda.org/manual/7.12/user-guide/process-engine/database/#configuration-for-microsoft-sql-server

Hope this helps, Ingo