adhoc task: mod_forum\task\send_user_notifications- lock created but not released

adhoc task: mod_forum\task\send_user_notifications- lock created but not released

by george williams -
Number of replies: 0

Hi All,

Apologies in advance if this is not the appropriate forum (please direct me to appropriate forum if that is the case) 

Moodle 3.9, Windows Server, SQL Server. 

On a fairly regular basis, when sending user notification to users via cron job,  they fail with following error:

 Execute adhoc task: mod_forum\task\send_user_notifications

... started 16:46:04. Current memory use 28MB.

Sending messages to 1814703 (95988)

!!! Coding error detected, it must be fixed by a programmer: A lock was created but not released at:

[dirroot]\lib\cronlib.php on line 154

 Code should look like:

 $factory = \core\lock\lock_config::get_lock_factory('type');

 $lock = $factory->get_lock(Resource id #1538);

 $lock->release();  // Locks must ALWAYS be released like this.

 !!!

When this happens the rest of scheduled task or ad-hoc tasks won't run until process time's out ( presume this related to site admin>server>task>task processing setting i.e. as hoc task runner lifetime?) Trouble is when Cron starts running again, it will work until it hits another one of these notifications. 

The same job runs fine when I run it via CLI: 

php

admin/tool/task/cli/adhoc_task.php --execute=\mod_forum\task\send_user_notifications

I am just wondering where else to look (apologies but our main Moodle Admin\developer has suddenly left) so seeing what else I can do to help diagnose the issue.

Thanks in advance. 


Average of ratings: -