I upgraded Moodle from 3.6.7 to 3.7.7 and am having an issue with a stuck task. The task is Background processing for assignment module \mod_assign\task\cron_task. If I disable this task everything else goes through, when enabled by default it just hangs. Has anyone else had issues with this, I've let it go for an hour so far and it seems stuck.
A 3.6.x to a 3.7.x shouldn't have involved anything related to moodledata unless you also migrated (moved to another server). See anything in your web server error logs?
Suggest running only the specific task via command line in admin/tool/task/cli/ of code.
php schedule_task.php --execute="\mod_assign\task\cron_task"
Doing it alone via command line you might see some errors or there is just a lot of assignments that need prep for grading.
Thanks for replying to my post. I ended up disabling mod_assign and running Cron without it and it finished without any issues. I then enabled mod_assign and let it run, it took about 2 hours, but it finished. I then let Cron run again and it's now working normal.
I'm new to Moodle 3.7 and see that there is a task logs section, which I am getting four fails. Three of them are \core_course\task\course_delete_modules, the fourth is \core\task\refresh_mod_calendar_events_task. Any help would be much appreciated.
adhoc task: core_course\task\course_delete_modules
... started 14:09:59. Current memory use 14.3MB.
... used 5 dbqueries
... used 0.0034592151641846 seconds
Adhoc task failed: core_course\task\course_delete_modules,Coding error detected, it must be fixed by a programmer: The course module 122816 could not be deleted. #0 C:\inetpub\wwwroot\moodle\course\classes\task\course_delete_modules.php(66): course_delete_module('122816')
#1 C:\inetpub\wwwroot\moodle\lib\cronlib.php(286): core_course\task\course_delete_modules->execute()
#2 C:\inetpub\wwwroot\moodle\lib\cronlib.php(166): cron_run_inner_adhoc_task(Object(core_course\task\course_delete_modules))
#3 C:\inetpub\wwwroot\moodle\lib\cronlib.php(76): cron_run_adhoc_tasks(1596909953)
#4 C:\inetpub\wwwroot\moodle\admin\cli\cron.php(61): cron_run()
Execute adhoc task: core\task\refresh_mod_calendar_events_task ... started 14:09:54. Current memory use 13.6MB. Refreshing events for assign ... used 309 dbqueries ... used 4.5637338161469 seconds Adhoc task failed: core\task\refresh_mod_calendar_events_task,Invalid course module ID
Oh ... Windows ... not a windows person ... but ...
From what you've described it doesn't sound like your cron job wasn't set to run frequently enough ... even when site was a 3.6 (prior to upgrade). Once a minute is recommendation.
Adhoc task can be run from command line ... suggest you do ... located in admin/tool/task/cli/
Will get the help screen for the script
Scheduled cron tasks.
--showsql Show sql queries before they are executed
--showdebugging Show developer level debugging information
--execute Run all queued adhoc tasks
-h, --help Print out this help
$sudo -u www-data /usr/bin/php admin/tool/task/cli/adhoc_task.php --execute
you might have to let it run or run it multiple times to catch up.
after it runs, it will print out a list of corrected courseid's, your background processor for assignments should run fine after. We have been running on the same database/upgraded over the years since 1.4.x