microsoft / o365-moodle

Office 365 and Azure Active Directory plugins for Moodle
GNU General Public License v3.0
180 stars 137 forks source link

Cron problem with missing adhoc task after upgrade (Moodle 4.1.) #2354

Open anieminen opened 1 year ago

anieminen commented 1 year ago

Hi,

Recently we upgraded Moodle from version 3.9 to 4.1 with M365 plugins. After the upgrade, adhoc tasks are not running. The problem seems to be caused by an old adhoc task \local_o365\task\sharepointaccesssync, which doesn't exist anymore, but is still present in the adhoc task queue.

So the task(s) with that class name should be deleted from task_adhoc database table when upgrading the local_o365 plugin. Doing this manually fixes the problem.

Trying to run the missing adhoc task causes an exception every time when Moodle cron is run, and this also prevents other adhoc tasks from running:

Default exception handler: Exception: Call to a member function get_concurrency_limit() on bool Debug:
Error code: generalexceptionmessage
* line 674 of /lib/classes/task/manager.php: Error thrown
* line ? of unknownfile: call to core\task\manager::core\task\{closure}()
* line 673 of /lib/classes/task/manager.php: call to array_map()
* line 184 of /lib/cronlib.php: call to core\task\manager::get_next_adhoc_task()
* line 76 of /lib/cronlib.php: call to cron_run_adhoc_tasks()
* line 178 of /admin/cli/cron.php: call to cron_run()
Urpokarhu1 commented 1 year ago

@weilai-irl any progress on fixing this?

weilai-irl commented 1 year ago

Hi @anieminen and @Urpokarhu1

The old ad-hoc task has been removed some time ago. Please feel free to remove the remaining instances of such tasks from the tasks_adhoc table. They shouldn't be hanging in there any more.

Regards, Lai