Stuck lock

This error is most commonly observed in the cron logs:

$ sudo -u <basename> php ~<basename>/current/admin/cli/cron.php
[snip]
Redis lock; pid=18617; Waiting to get ${dbname}_cron_core_cron lock
Redis lock; pid=18617; Lock timeout, did not obtain ${dbname}_cron_core_cron lock
Default exception handler: The operation timed out while waiting for a lock. Debug:
Error code: locktimeout
* line 469 of /lib/classes/task/manager.php: moodle_exception thrown
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 61 of /admin/cli/cron.php: call to cron_run()

!!! The operation timed out while waiting for a lock. !!!
!!
Error code: locktimeout !!
!! Stack trace: * line 469 of /lib/classes/task/manager.php: moodle_exception thrown
* line 66 of /lib/cronlib.php: call to core\task\manager::get_next_scheduled_task()
* line 61 of /admin/cli/cron.php: call to cron_run()
 !!

It's possible that an interrupted task will cause the lock to become stuck. To resolve, identify the name of the lock key being held in the log (e.g. ${dbname}_cron_core_cron above).

How the stuck lock should be cleared depends on the store.


Backlinks