-
Improvement
-
Resolution: Won't Do
-
Minor
-
None
-
3.2.3
Recently I had an issue where hundreds of items had been "marked for deletion" and were not deleting. Upon investigation I found this unhelpful error in the cron debugging:
Execute adhoc task: core_course\task\course_delete_modules
|
... started 17:45:06. Current memory use 10.1MB. |
instantiating backup controller f3804386fb1f367e9249808329542ddc
|
setting controller status to 100 |
loading controller plan
|
setting controller status to 300 |
applying plan defaults
|
setting controller status to 400 |
setting file inclusion to 1 |
checking plan security
|
setting controller status to 700 |
saving controller to db
|
calculating controller checksum c71b6339053f549d06603c988da53e0d
|
loading controller from db
|
notifying plan about excluded activities by type
|
setting controller status to 800 |
setting controller status to 1000 |
saving controller to db
|
Default exception handler: Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
|
[dirroot]/lib/classes/task/manager.php on line 424 |
|
Code should look like:
|
|
$factory = \core\lock\lock_config::get_lock_factory('type'); |
$lock = $factory->get_lock(Resource id #1940); |
$lock->release(); // Locks must ALWAYS be released like this. |
|
Debug:
|
Error code: codingerror
|
* line 117 of /lib/classes/lock/lock.php: coding_exception thrown |
* line 129 of /lib/cronlib.php: call to core\lock\lock->__destruct() |
* line 61 of /admin/cli/cron.php: call to cron_run() |
|
!!! Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
|
[dirroot]/lib/classes/task/manager.php on line 424 |
|
Code should look like:
|
|
$factory = \core\lock\lock_config::get_lock_factory('type'); |
$lock = $factory->get_lock(Resource id #1940); |
$lock->release(); // Locks must ALWAYS be released like this. |
|
!!!
|
!!
|
Error code: codingerror !!
|
!! Stack trace: * line 117 of /lib/classes/lock/lock.php: coding_exception thrown |
* line 129 of /lib/cronlib.php: call to core\lock\lock->__destruct() |
* line 61 of /admin/cli/cron.php: call to cron_run() |
!!
|
I was not able to suss out what the issue was based on that debugging, so to the database I went. Looking in the backup_controllers table I could see that Moodle was attempting to back up the same activity over and over again. It happened to be a bad plug-in, which once was removed, resolved the issue. However, this one course module was stopping hundreds of other items from being removed.
Would it be possible to a) have this task output more helpful debugging, like perhaps the course module id that it is failing on? and b) have this task handle errors more gracefully and continue with other modules queued for deletion?
- blocks
-
MDL-70489 course_delete_modules - remove try catch that hides errors in cron logs
-
- Open
-
- has a non-specific relationship to
-
MDL-68774 'course_delete_modules' adhoc task fails when inserting {files} record with duplicate 'pathnamehash' field
-
- Reopened
-
- has been marked as being related by
-
MDL-60367 Adhoc task failed: core_course\task\course_delete_modules
-
- Closed
-