Adhoc Tasks Not Running (and lock_db)

Adhoc Tasks Not Running (and lock_db)

by Tristan daCosta -
Number of replies: 1

Hi.

I've just noticed that our adhoc tasks have not run in 4 days. This was brought to my attention when someone mentioned that forum posts weren't being delivered (internal notification and email).

Looking in the 'task_adhoc' table, i can see there are 8k+ adhoc tasks, dating back 4 days (\mod_forum\task\send_user_notifications) and 2k(ish) other tasks like 'forum digests', 'delete modules', etc. So it would appear that something happened around that time that caused these tasks to stop running.

Looking in the 'lock_db' table i can see a few locked tasks, a couple of which refer to 'adhoc'.


idresourcekeyexpiresowner

253465core_message_migrate_data_2_2214315993266579a50e1d2-8510-4ad1-b50f-897fae126874

253463cron_adhoc_3359615993266579c3667cf-6908-424f-87bd-7890e79d0412

251874cron_adhoc_task_runner_015993266571a204629-30ef-4d8c-83ac-469488dc1d9a

738302_221431596038106551f372b-ba9a-41ce-8a5d-62b74c86e9b9

73829adhoc_335961596038105b8df5e7c-ff7e-45a1-a327-fde815421081

We ran a LARGE user sync task the night before, so guess that this has created a task lock.

My question is... would any of these locks be responsible for stopping the adhoc tasks from running, and if so, is it safe to delete these records?

On a similar note, i notice approx 300k rows in the lock_db table, but the 'expires' and 'owner' columns are NULL. Should they be there, or should they be cleaned up?

Moodle v3.9.1

Thanks in advance

Average of ratings: -
In reply to Tristan daCosta

Re: Adhoc Tasks Not Running (and lock_db)

by Tristan daCosta -
Although I still need to get to the bottom of the numerous records in the lock_db table, the probem of adhoc tasks not running has been solved.

I'll post the solution here in case anyone else finds themeselves here with similar problems.

There was a user data request (core privacy plugin) in the queue (task_adhoc table) which the adhoc task runner was getting stuck on. Running the adhoc_task.php script (/admin/cli/adhoc_tasks.php --execute), showed clearly where this was failing. Deleting the request directly from the task_adhoc table allowed the task runner to continue, and only took a couple of hours to process 13k outstanding tasks.
Average of ratings: Useful (1)