-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
3.11.2
-
MOODLE_311_STABLE
If a process is hard killed for whatever reason, the running tasks data has invalid metadata left behind which makes it look like the task is still running.
It is very easy to reproduce doing a double Control-C on the cron.php cli, or a kill -9
I hit this same problem in the lockstats plugin which is now more or less redundant, and the way I fixed this there is looping through the list of theoretically running tasks and re-trying to gain their lock with a 0 timeout. If you didn't get the lock then you know its running (which does assume you have a decent lock implementation) . If you get the lock then you know it isn't running and you can clean up the metadata.
So we can do this lock api double check either on the runningtasks.php page in realtime. The act of rerunning the same task does appear to auto heal the metadata, so it is tasks that run once a day or once a week which appear incorrect most of the time.
- duplicates
-
MDL-73293 Adhoc task metadata around running tasks is wrong when processes are killed
- Closed