[4.x]: could not acquire a lock to save the element
Nobody has claimed this yet.
- 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
- login in admin panel
- go to entries
- edit an entry
- save the edited entry
- page will be directed to an error page
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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