We are getting random ActivitiOptimisticLockingException's and are struggling to understand why. We do have multiple instances of the Activiti engine running against one database, but there aren't any parallel threads going, and the error occurs on a RuntimeServiceImpl.getVariable() call, as below. We're fairly certain that there isn't any concurrent access for the process instance either.
Caused by: org.activiti.engine.ActivitiOptimisticLockingException: ByteArrayEntity[id=142051, name=var-facts, size=6455] was updated by another transaction concurrently
at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:562)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:444)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:170)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:117)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
at org.activiti.engine.impl.RuntimeServiceImpl.getVariable(RuntimeServiceImpl.java:124)
When I look at the flushUpdates call, it appears that an update is being performed.
Can someone please explain why an update to ByteArrayEntity would be occurring for a getVariable() call?
Thanks,
Herman Post