-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ad-hoc task fails #18
Comments
Some Problem: Execute adhoc task: tool_deletecourses\task\delete_courses_task Code should look like: $factory = \core\lock\lock_config::get_lock_factory('type'); Backtrace:
|
What version of the plugin and what version of Moodle? |
Moodle: 4.1.1+ |
Seeing the same on a Moodle instance I look after. Moodle 3.9.17 (build: 20220912) I found the following in the task logs. But PHP's error log doesn't show anything obviously related.
A moodle admin was using the tool to delete a large number of courses. It ran fine a week ago and took 11 hours & 11 minutes to delete a large # of courses. He ran it again, 5 days later, and it ran for 18 minutes before encountering the lock error. All subsequent runs of the tool fail in less than a second, with the same lock error. So it seems like there's a lock hanging around somewhere that needs to be cleaned up. |
It sounds to me like there's something about that particular course that causes the plugin to fail. Let me think about how to throw a better debugging message. |
I'm wondering if it's related to this core issue: https://tracker.moodle.org/browse/MDL-77924. |
Testing confirms that some, not all, activity modules are affected by MDL-77924 and that this plugin will fail if those plugins are present in a course and disabled. That's not necessarily the problem folks are encountering here, but it is definitely a scenario that produces this issue. |
Moodle 3.11.8
`
Execute adhoc task: tool_deletecourses\task\delete_courses_task
... started 14:35:07. Current memory use 28.2MB.
... used 160 dbqueries
... used 2.2654910087585 seconds
Adhoc task failed: tool_deletecourses\task\delete_courses_task,Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
/var/www/moodle/releases/20220811171319Z/admin/tool/deletecourses/classes/task/delete_courses_task.php on line 109
Code should look like:
$factory = \core\lock\lock_config::get_lock_factory('type');
$lock = $factory->get_lock(cf96af778e845cf02aae535c741c3dd75f883f05);
$lock->release(); // Locks must ALWAYS be released like this.
Backtrace:
The text was updated successfully, but these errors were encountered: