Hello,
My process runs perfectly fine without any error even with some jobs being involved asynchronously.
For business reason, I need to query the current process state (just readonly query).
I noticed that doing so leads to OptimisticLockingException at the job executor level.
I perform my queries from a separate thread (not from a job of course)
I noticed that amongst the queries I do, the one retrieving variable instances seems to be causing the trouble.
List<VariableInstance> vars = runtimeService.createVariableInstanceQuery().executionIdIn(processId).list();
Again, I do not modify anything, I just read the variable names and values.
Find below the exception. Should not reading be totally safe ?
Thanks
Nicolas.
org.camunda.bpm.engine.OptimisticLockingException: ENGINE-03005 Execution of 'UPDATE VariableInstanceEntity[67640a3a-dc23-48b9-a40a-3adc2328b922]' failed. Entity was updated by another transaction concurrently.
at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.concurrentUpdateDbEntityException(EnginePersistenceLogger.java:132) ~[camunda-engine-7.9.0.jar:7.9.0]
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.handleOptimisticLockingException(DbEntityManager.java:484) ~[camunda-engine-7.9.0.jar:7.9.0]
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.checkFlushResults(DbEntityManager.java:443) ~[camunda-engine-7.9.0.jar:7.9.0]