craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 626 forks source link

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

Open bowen31337 opened 11 months ago

bowen31337 commented 11 months ago

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

i-just commented 11 months ago

Hi, thanks for getting in touch!

Do you have any custom configuration for mutex?

By default, mutex locks are files stored in storage/runtime/mutex. Can you start by clearing that directory and check if that fixes the issue? If it then happens again, have a look through the logs (starting with storage/logs/phperrors.log) and see if there’s anything there that looks like it could be related?