craftcms / craftcms/cms

[4.x]: could not acquire a lock to save the element

Open
#13,783 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug craft4
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

when an entry is edited and saved, the error occurs with message "Could not acquire a lock to save the element."

Steps to reproduce
  1. login in admin panel
  2. go to entries
  3. edit an entry
  4. save the edited entry
  5. page will be directed to an error page
image
Expected behavior

the edited entry should be saved successfully.

Actual behavior

the error shows, the stack trace is:
{
"trace": [
"#0 [internal function]: craft\controllers\ElementsController->actionApplyDraft()",
"#1 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)",
"#2 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)",
"#3 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('apply-draft', Array)",
"#4 /app/vendor/craftcms/cms/src/web/Application.php(304): yii\base\Module->runAction('elements/apply-...', Array)",
"#5 /app/vendor/craftcms/cms/src/web/Application.php(607): craft\web\Application->runAction('elements/apply-...', Array)",
"#6 /app/vendor/craftcms/cms/src/web/Application.php(283): craft\web\Application->_processActionRequest(Object(craft\web\Request))",
"#7 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))",
"#8 /app/web/index.php(12): yii\base\Application->run()",
"#9 {main}"
],
"memory": 29816648,
"exception": "[object] (yii\web\ServerErrorHttpException(code: 0): Could not acquire a lock to save the element. at /app/vendor/craftcms/cms/src/controllers/ElementsController.php:1447)"
}

Craft CMS version

Craft Pro 4.5.6.1

PHP version

8.0.30

Operating system and version

Linux 6.2.0-1012-aws

Database type and version

PostgreSQL 15.3

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.0-50)

Installed plugins and versions
  • Amazon S3 | 2.0.3
  • Navigation | 2.0.21
  • Redactor | 3.0.4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with craft/controllers/ElementsController.php at actionApplyDraft(), which the stack trace identifies as the failure point, and reproduce the listed admin-panel entry editing steps. Done means an edited entry saves successfully without the lock error or error page.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.