Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing lock release error #537

Open
wants to merge 1 commit into
base: MOODLE_310_STABLE
Choose a base branch
from

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.

@@ -214,6 +214,7 @@ public function acquire_object_lock($contenthash, $timeout = 0) {
$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.

None yet

2 participants