One scheduled task successfully completing but closing/unlocking failing

Re: One scheduled task successfully completing but closing/unlocking failing

by Steve Howes -
Number of replies: 1
Thanks to everyone who replied, it turned out that this was the resolution; it was initially hidden by the fact we had increased debugging output to try and track down the exact point of failure but in doing so had only increased again the needed packet size. Once we removed the extra outputs the task ran and completed successfully with cleanup and removing the lock.

Thanks.
In reply to Steve Howes

Ri: Re: One scheduled task successfully completing but closing/unlocking failing

by Francesco Pepoli -

Sorry I have the same problem and I don't understand how you solved it?

Moodle 3.8.2+ (Build: 20200506)

Default exception handler: Si è verificato un errore durante la lettura del database Debug: MySQL server has gone away

SELECT * FROM mdl_task_scheduled WHERE classname = ?

[array (

  0 => '\\tool_analytics\\task\\predict_models',

)]

Error code: dmlreadexception

* line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown

* line 1247 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()

* line 1587 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()

* line 1559 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()

* line 1538 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()

* line 682 of /lib/classes/task/manager.php: call to moodle_database->get_record()

* line 229 of /lib/cronlib.php: call to core\task\manager::scheduled_task_failed()

* line 119 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()

* line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()

* line 61 of /admin/cli/cron.php: call to cron_run()


PHP Fatal error:  Uncaught coding_exception: E' stato rilevato un errore di programmazione, deve essere sistemato da un programmatore: A lock was created but not released at:

/var/www/html/lib/classes/task/manager.php on line 554

 $factory = \core\lock\lock_config::get_lock_factory('type');

 $lock = $factory->get_lock(Resource id #682);

 $lock->release();  // Locks must ALWAYS be released like this.

 in /var/www/html/lib/classes/lock/lock.php:117

Stack trace:

#0 [internal function]: core\lock\lock->__destruct()

#1 {main}

  thrown in /var/www/html/lib/classes/lock/lock.php on line 117