drachels / moodle-mod_mootyper

4 stars 18 forks source link

Scheduled task fails repeatedly with no output #114

Open thebenkahn opened 11 months ago

thebenkahn commented 11 months ago

Hello, I have a site running MOODLE-4.1.5 and Mootyper 4.2.4 (Build: 2023073000)

Since the last upgrade, the scheduled task Background processing for MooTyper module fails ungracefully almost immediately when run, causing Moodle to exit the cron and fail to run any other tasks.

I ran the task with debugging on and do see a couple of PHP warnings - here is the scheduled task log scrubbed of identifying data.... I'm not sure if the PHP warnings could be an issue here? The site is running PHP 8.0. If there is any other troubleshooting info I can gather I'd be happy to.

For now I am running the site with the task disabled since it impacts other processes.

Redis lock; pid=1854214; Waiting to get moodle_mysitenamehere_cron_core_cron lock Redis lock; pid=1854214; Obtained moodle_mysitenamehere_cron_core_cron lock with value hostname=ip-10-2-5-87&processid=1854214 Redis lock; pid=1854214; Waiting to get moodle_mysitenamehere_cron_\mod_mootyper\task\cron_task lock Redis lock; pid=1854214; Obtained moodle_mysitenamehere_cron_\mod_mootyper\task\cron_task lock with value hostname=ip-10-2-5-87&processid=1854214 Redis lock; pid=1854214; Released moodle_mysitenamehere_cron_core_cron lock Execute scheduled task: Background processing for MooTyper module (mod_mootyper\task\cron_task) ... started 12:31:22. Current memory use 14.5 MB. PHP Warning: Undefined variable $USER in /var/www/mysite/mod/mootyper/classes/task/cron_task.php on line 62 PHP Warning: Attempt to read property "id" on null in /var/www/mysite/mod/mootyper/classes/task/cron_task.php on line 62 Redis lock; pid=1854214; Waiting to get moodle_mysitenamehere_mod_mootyper_renderer_factory_user: lock Redis lock; pid=1854214; Obtained moodle_mysitenamehere_mod_mootyper_renderer_factory_user: lock with value hostname=ip-10-2-5-87&processid=1854214 ready to release lock Redis lock; pid=1854214; Auto-release called, releasing 1 locks Redis lock; pid=1854214; Released moodle_mysitenamehere_cron_\mod_mootyper\task\cron_task lock Redis lock; pid=1854214; Auto-release called, releasing 1 locks Redis lock; pid=1854214; Released moodle_mysitenamehere_mod_mootyper_renderer_factory_user: lock Redis lock; pid=1854214; Shared Redis connection is closed.

drachels commented 11 months ago

I have been sick and almost blind at times this year and have NOT gotten to do as much work on MooTyper as I would like. I actually added the cron_task.php file when I was reorganizing all the MooTyper files, with the idea of setting up something to do grade updates a little better to go with the new completion settings. I am starting to think that I need to get rid of that file and do something totally different, like I've seen with some of the other activity modules. I am not feeling well at the moment, but I will try to do something about this in the next day or two.

thebenkahn commented 11 months ago

Hi @drachels - sorry to hear you have not been feeling well and I hope you recover soon. It sounds like the scheduled task is not critical to the functionality of the plugin and it might be OK for now just to leave it disabled?

Again thank you and please take care of yourself! - Ben

drachels commented 7 months ago

Sorry to take so long getting to this. Currently, I have some plans for the cron_task.php file, but just keep getting delayed by other projects.

The warning you are getting can be prevented simply by changing the public function execute(0 at line 46 of the cron_task.php file so that it contains nothing but, return true;, similar to the picture: execute1