General developer forum

Cron Lock

 
Picture of Mike C
Cron Lock
 

First time post here. These forums have been very helpful in troubleshooting in the past however we currently have an unusual issue with our admin cron that I could not find elsewhere.

++ Failed to load task: \mod_webexactivity\task\update_all_recordings ++
* line 309 of /lib/classes/task/manager.php: call to debugging()
* line 544 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 81 of /admin/cron.php: call to cron_run()
++ Failed to load task: \mod_webexactivity\task\update_medium_recordings ++
* line 309 of /lib/classes/task/manager.php: call to debugging()
* line 544 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 81 of /admin/cron.php: call to cron_run()
++ Failed to load task: \mod_webexactivity\task\update_recent_recordings ++
* line 309 of /lib/classes/task/manager.php: call to debugging()
* line 544 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 81 of /admin/cron.php: call to cron_run()
++ Failed to load task: \mod_webexactivity\task\update_open_sessions ++
* line 309 of /lib/classes/task/manager.php: call to debugging()
* line 544 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 81 of /admin/cron.php: call to cron_run()
++ Failed to load task: \local_email\task\cron_task ++
* line 309 of /lib/classes/task/manager.php: call to debugging()
* line 544 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 81 of /admin/cron.php: call to cron_run()
++ Failed to load task: \local_activity_reminders\task\cron_task ++
* line 309 of /lib/classes/task/manager.php: call to debugging()
* line 544 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 81 of /admin/cron.php: call to cron_run()
++ Failed to load task: \mod_webexactivity\task\remove_deleted_recordings ++
* line 309 of /lib/classes/task/manager.php: call to debugging()
* line 544 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 81 of /admin/cron.php: call to cron_run()
++ Failed to load task: \mod_tincanlaunch\task\expire_credentials ++
* line 309 of /lib/classes/task/manager.php: call to debugging()
* line 544 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 81 of /admin/cron.php: call to cron_run()
++ Failed to load task: \mod_reengagement\task\cron_task ++
* line 309 of /lib/classes/task/manager.php: call to debugging()
* line 544 of /lib/classes/task/manager.php: call to core\task\manager::scheduled_task_from_record()
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 81 of /admin/cron.php: call to cron_run()

Fatal error: Uncaught coding_exception: Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
/var/www/html/xxxx/lib/classes/task/manager.php on line 527

 Code should look like:

 $factory = \core\lock\lock_config::get_lock_factory('type');
 $lock = $factory->get_lock(Resource id #852);
 $lock->release();  // Locks must ALWAYS be released like this.

 in /var/www/html/xxxxx/lib/classes/lock/lock.php:117
Stack trace:
#0 [internal function]: core\lock\lock->__destruct()
#1 {main}
  thrown in /var/www/html/xxxxx/lib/classes/lock/lock.php on line 117
 this is something I have never come across before and we have yet to find the coding error.  error log shows only one error: 

-----------

PHP Fatal error:  Uncaught coding_exception: Coding error detected, it must be fixed by a programmer: A lock was created but not released at:\n/var/www/html/xxx/lib/classes/task/manager.php on line 527\n\n Code should look like:\n\n $factory = \\core\\lock\\lock_config::get_lock_factory('type');\n $lock = $factory->get_lock(Resource id #852);\n $lock->release();  // Locks must ALWAYS be released like this.\n\n in /var/www/html/xxxx/lib/classes/lock/lock.php:117\nStack trace:\n#0 [internal function]: core\\lock\\lock->__destruct()\n#1 {main}\n  thrown in /var/www/html/xxxx/lib/classes/lock/lock.php on line 117

----------------
These are not files we have ever edited, there were no server environment changes and it just seemed to start randomly day or so ago 

I should also add that after flushing all caches in the site admin, the admin is showing a blank white page now. So our admin (and cron) are pretty busted up.

We are using php7, moodle 3.4.2, and remui theme 3.4.0

Any assistance would be greatly appreciated 


regards,

-mike









 
Average of ratings: -
Picture of Andrew Nicols
Re: Cron Lock
Core developersMoodle HQParticularly helpful MoodlersPlugin developersTesters

Hi Mike,

In this instance the failure to release the lock is just a bad and misleading error message.

Something went wrong during the task which has meant that the task in question did not release it's own lock.

The task manager checks that all locks have been released appropriately after the task ends (whether it ends through failure or success), and warns that the lock was not released properly.

In this instance I would guess that something is causing some of the tasks from your plugins to not be found.

These tasks are:

  • \mod_webexactivity\task\update_all_recordings
  • \mod_webexactivity\task\update_medium_recordings
  • \mod_webexactivity\task\update_open_sessions
  • \mod_webexactivity\task\update_recent_recordings
  • \local_email\task\cron_task
  • \local_activity_reminders\task\cron_task
  • \mod_webexactivity\task\remove_deleted_recordings
  • \mod_tincanlaunch\task\expire_credentials
  • \mod_reengagement\task\cron_task

I would advise checking that the server where you run cron has these files still on disk as a first check. I'd also recommend purging caches on that server (or all servers).

Andrew

 
Average of ratings: -
Picture of Mike C
Re: Cron Lock
 

Hi Andrew. thx for the info! We restored from a backup (7 days back) and all was working fine until last night again. We have cleared the caches as well. This time we are getting 

Moodle upgrade pending, cron execution suspended.

when running cron manually and the admin sections of the site are producing blank pages.

sad


 
Average of ratings: -