Problem running cron after the upgrade (Moodle 3.3.1)

Problem running cron after the upgrade (Moodle 3.3.1)

by Saša Lacković -
Number of replies: 2

Hi!

I have upgraded my Moodle site from version 3.2.2 to the newest version (3.3.1). Everything works fine except the cronjob that should be run every minute. I started it manually and it stops with error message:

Refreshing events for qcreate
Default exception handler: Otkrivena je programerska pogreška, mora ju ispraviti programer: 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 #1391);
 $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 91 of /lib/cronlib.php: call to core\lock\lock->__destruct()
* line 61 of /admin/cli/cron.php: call to cron_run()
!!! Otkrivena je programerska pogreška, mora ju ispraviti programer: 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 #1391);
 $lock->release();  // Locks must ALWAYS be released like this.
 !!!

Can someone help me? I don't know what to do to solve the problem. I tried searching the Google, but didn't find any answer.
Average of ratings: -
In reply to Saša Lacković

Re: Problem running cron after the upgrade (Moodle 3.3.1)

by Damyon Wiese -
Picture of Core developers Picture of Moodle HQ Picture of Plugin developers Picture of Testers

This is a bug in the qcreate plugin - it needs to be updated to work with recent versions of Moodle. Unfortunately the author of this plugin is now retired and it is looking for a new maintainer (see the comments on https://moodle.org/plugins/mod_qcreate).

You could try contacting a Moodle partner to get a quote on upgrading this plugin (and hopefully release the updated code so that others can use it).

https://moodle.com/partners/


Average of ratings: Useful (1)
In reply to Damyon Wiese

Re: Problem running cron after the upgrade (Moodle 3.3.1)

by Jean-Michel Védrine -

Hello,

Looking at my code (after more than 2 years away from Moodle) it seems I forgot to close a recordset after use in at least 2 places in my code for the qcreate tasks.

Sorry I will release a new version correcting this.

But please note that because of my retirement I can't say that there are not other problems in this activity module with Moodle recent versions and I can't certify that I will find time to correct other problems, if some are found, but as this an evident mistake (my bad) and I easy fix, I would be stupid not to fix it.