I am receiving an error when the 'mod_attendanceregister\task\cron_task' Cron Job is running.
We have been unable to find the cause of this issue and I am wondering whether you had some insight into what might be causing this.
The error output is below, this is what is given after trying to run the scheduled task in CLI.
`... used 227.52029895782 seconds
Scheduled task failed: Recalculate attendanceregister sessions (mod_attendanceregister\task\cron_task),Error reading from database
Default exception handler: Error reading from database Debug:
SELECT * FROM mdl_task_scheduled WHERE classname = ?
[array (
0 => '\mod_attendanceregister\task\cron_task',
)]
Error code: dmlreadexception
line 479 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 288 of /lib/dml/mssql_native_moodle_database.php: call to moodle_database->query_end()
line 794 of /lib/dml/mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end()
line 828 of /lib/dml/mssql_native_moodle_database.php: call to mssql_native_moodle_database->get_recordset_sql()
line 1551 of /lib/dml/moodle_database.php: call to mssql_native_moodle_database->get_records_sql()
line 1523 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
line 1502 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
line 598 of /lib/classes/task/manager.php: call to moodle_database->get_record()
line 103 of /lib/cronlib.php: call to core\task\manager::scheduled_task_failed()
line 61 of /admin/cli/cron.php: call to cron_run()
!!! Error reading from database !!!
PHP Fatal error: Uncaught exception 'coding_exception' with message 'Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
/var/www/html/moodle/lib/classes/task/manager.php on line 475
Code should look like:
$factory = \core\lock\lock_config::get_lock_factory('type');
$lock = $factory->get_lock(Resource id #658);
$lock->release(); // Locks must ALWAYS be released like this.
' in /var/www/html/moodle/lib/classes/lock/lock.php:117
Stack trace:
I am receiving an error when the 'mod_attendanceregister\task\cron_task' Cron Job is running. We have been unable to find the cause of this issue and I am wondering whether you had some insight into what might be causing this.
The error output is below, this is what is given after trying to run the scheduled task in CLI.
`... used 227.52029895782 seconds Scheduled task failed: Recalculate attendanceregister sessions (mod_attendanceregister\task\cron_task),Error reading from database Default exception handler: Error reading from database Debug: SELECT * FROM mdl_task_scheduled WHERE classname = ? [array ( 0 => '\mod_attendanceregister\task\cron_task', )] Error code: dmlreadexception
!!! Error reading from database !!! PHP Fatal error: Uncaught exception 'coding_exception' with message 'Coding error detected, it must be fixed by a programmer: A lock was created but not released at: /var/www/html/moodle/lib/classes/task/manager.php on line 475
Code should look like:
$factory = \core\lock\lock_config::get_lock_factory('type'); $lock = $factory->get_lock(Resource id #658); $lock->release(); // Locks must ALWAYS be released like this.
' in /var/www/html/moodle/lib/classes/lock/lock.php:117 Stack trace:
0 [internal function]: core\lock\lock->__destruct()
1 {main}
thrown in /var/www/html/moodle/lib/classes/lock/lock.php on line 117 `