AnsweredAssumed Answered

Race condition in job executor?

Question asked by mandas on Jul 15, 2013
Latest reply on Jul 17, 2013 by frederikheremans1
Hello all,

We had the following case, an async and exclusive service task calling a cdi method. The job executor is configured to lock jobs for 5 mins so as the jboss server transaction timeout. It has been noticed that this cdi method, under heavy load, had its transaction timed out so nothing was updated in ACT_RU_JOB (neither retries, nor lock time). Then another job executor thread was picking up the job and so on…To investigate our use case, we toggled a breakpoint inside the method to pause the execution, and then we went at ACT_RU_JOB and set lock time in the past. Then we had two threads trying the same task.

As waittimeinmillis and transaction timeout were equal, we assumed that maybe we had a race condition, with a possible workaround to increase waittimeinmillis to avoid it. (lock time of the job exceeded millis before the transaction timeout, and a second job executor picks up the job, so as the two invocations co-exist for a small amount of time)

But afterwards, I re-read about exclusive jobs, and I 'm wondering how we can end up with two job executor threads trying the same job, provided that exclusive guarantees that this job cannot run at the same time with another one (including itself?) of the same process instance.

Can someone clarify? (activiti-5.11)