After updating to Moodle 3.7 we were experiencing errors when cron was running the campusconnect cron job.
Following error was thrown:
Jul 06 14:42:08 localhost php[25720]: Processing cron function for local_campusconnect...
Jul 06 14:42:08 localhost php[25720]: ... started 14:42:08. Current memory use 27.8MB.
Jul 06 14:42:08 localhost php[25720]: Checking for updates on ECS server 'Universitätsverbund'
Jul 06 14:42:08 localhost php[25720]: ECS connection error, sending notification to site admins - Error: curl error: (77)
Jul 06 14:42:08 localhost php[25720]: Default exception handler: Fehler: Argument 1 passed to message_send() must be an instance of core\message\message, instance of stdClass given, called in [dirroot]/local/campusconnect/lib.php on line 113 Debug:
Jul 06 14:42:08 localhost php[25720]: Error code: generalexceptionmessage
Jul 06 14:42:08 localhost php[25720]: * line 57 of /lib/messagelib.php: TypeError thrown
Jul 06 14:42:08 localhost php[25720]: * line 113 of /local/campusconnect/lib.php: call to message_send()
Jul 06 14:42:08 localhost php[25720]: * line 56 of /local/campusconnect/lib.php: call to local_campusconnect_ecs_error_notification()
Jul 06 14:42:08 localhost php[25720]: * line 466 of /lib/cronlib.php: call to local_campusconnect_cron()
Jul 06 14:42:08 localhost php[25720]: * line 163 of /lib/classes/task/legacy_plugin_cron_task.php: call to cron_execute_plugin_type()
Jul 06 14:42:08 localhost php[25720]: * line 201 of /lib/cronlib.php: call to core\task\legacy_plugin_cron_task->execute()
Jul 06 14:42:08 localhost php[25720]: * line 119 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
Jul 06 14:42:08 localhost php[25720]: * line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
Jul 06 14:42:08 localhost php[25720]: * line 61 of /admin/cli/cron.php: call to cron_run()
Jul 06 14:42:08 localhost php[25720]:
Jul 06 14:42:08 localhost php[25720]: !!! Fehler: Argument 1 passed to message_send() must be an instance of core\message\message, instance of stdClass given, called in [dirroot]/local/campusconnect/lib.php on line 113 !!!
Jul 06 14:42:08 localhost php[25720]: PHP Warning: pg_num_fields() expects parameter 1 to be resource, null given in /opt/web/html/lib/dml/pgsql_native_moodle_database.php on line 873
Jul 06 14:42:08 localhost php[25720]: PHP Warning: pg_fetch_assoc() expects parameter 1 to be resource, null given in /opt/web/html/lib/dml/pgsql_native_moodle_database.php on line 883
Jul 06 14:42:08 localhost php[25720]: PHP Notice: Trying to get property 'unlocked' of non-object in /opt/web/html/lib/classes/lock/postgres_lock_factory.php on line 213
Jul 06 14:42:08 localhost php[25720]: PHP Fatal error: Uncaught coding_exception: Fehler in der Kodierung gefunden, den nur ein Programmierer korrigieren kann: A lock was created but not released at:
Jul 06 14:42:08 localhost php[25720]: /opt/web/html/lib/classes/task/manager.php on line 554
Jul 06 14:42:08 localhost php[25720]:
Jul 06 14:42:08 localhost php[25720]: Code should look like:
Jul 06 14:42:08 localhost php[25720]:
Jul 06 14:42:08 localhost php[25720]: $factory = \core\lock\lock_config::get_lock_factory('type');
Jul 06 14:42:08 localhost php[25720]: $lock = $factory->get_lock(405675);
Jul 06 14:42:08 localhost php[25720]: $lock->release(); // Locks must ALWAYS be released like this.
Jul 06 14:42:08 localhost php[25720]:
Jul 06 14:42:08 localhost php[25720]: in /opt/web/html/lib/classes/lock/lock.php:117
Jul 06 14:42:08 localhost php[25720]: Stack trace:
Jul 06 14:42:08 localhost php[25720]: #0 [internal function]: core\lock\lock->__destruct()
Jul 06 14:42:08 localhost php[25720]: #1 {main}
Jul 06 14:42:08 localhost php[25720]: thrown in /opt/web/html/lib/classes/lock/lock.php on line 117
Jul 06 14:42:08 localhost systemd[1]: moodle-cron.service: main process exited, code=exited, status=1/FAILURE
Jul 06 14:42:08 localhost systemd[1]: Failed to start moodle-cron - Moodle Cron Timer.
After updating to Moodle 3.7 we were experiencing errors when cron was running the campusconnect cron job.
Following error was thrown: