AnsweredAssumed Answered

OptimisticLockingException in a clustered environment

Question asked by mhanrahan on Aug 8, 2017



We're running Activiti 5.21 in a clustered environment - that is, with two activiti hosts pointing to the same database.


Due to increased load, we have tried increasing the configuration of the Job Executor to 30 max threads instead of the defaulted 10, however, we're seeing the following DEBUG log in the logs at a fairly rapid rate, consistently more than once per second.


 Optimistic locking exception during job acquisition. If you have multiple job executors running against the same database, this exception means that this thread tried to acquire a job, which already was acquired by another job executor acquisition thread.This is expected behavior in a clustered environment. You can ignore this message if you indeed have multiple job executor acquisition threads running against the same database. Exception message: JobEntity [id=455903118] was updated by another transaction concurrently


It is happening on one host more than the other, and when we do a thread dump and grep for "", we note that the Job Executor gets up to 15 or so threads, and the other host is only getting to 1 or 2 threads


So my question is this: Is this still expected behaviour? I know the error says it is, but should the error happen at that frequency? Is there any way to reduce the conflicts between the two hosts?