Closed andrewnicols closed 4 years ago
Doh! This looked very familiar - I actually found these same issues testing last week, and while reviewing this I realized my near identical fixes are still sitting there uncommited on my dev box :/
thanks @andrewnicols this is all sorted now
When running high numbers of adhoc tasks on a fast system with multiple cron runners and after the implementation of MDL-67596, it's quite possible for a task to be looked at by multiple runners because the task still exists in the database at the time that the runner starts to request a new task.
This is harmless enough because they fail to acquire a lock and continue to look at the next task.
However, when a task finishes running it removes the record. When the runner fetches a list on a busy system, it may encounter a number of tasks which are still in-progress, and then get to a shorter-lived task which is no longer in progress and has now been removed from the database.
However the lockstats plugin makes the assumption that the adhoc task record still exists.