Skip to content

Conversation

@caiovncius
Copy link

In Moodle 3.11.+ we getting this error:

A lock was created but not released at: [dirroot]/admin/tool/objectfs/classes/local/store/object_file_system.php on line 216 Code should look like: $factory = \core\lock\lock_config::get_lock_factory('type'); $lock = $factory->get_lock(50e571f912ea1e8d29ccfeb56a43748b59f24c3d); $lock->release(); // Locks must ALWAYS be released like this.

In my scenario, looks it´s happening when I try access objectfs in interface and cron in same time.

$lockfactory = \core\lock\lock_config::get_lock_factory('tool_objectfs_object');
$this->logger->start_timing();
$lock = $lockfactory->get_lock($resource, $timeout);
$lock->release();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. You can't release the lock as soon as you get it. There must be a reason why the lock is not being released. We also found this bug ourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants