craftcms / cms

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

Publish draft results in "Exception: Could not acquire a lock to save a revision for element" #7661

Closed craftedsystems closed 3 years ago

craftedsystems commented 3 years ago

Description

I can not publish drafts.

Steps to reproduce

  1. Select a draft from the drop down
  2. Click "Publish draft" button
2021-03-08 23:27:04 [-][1][97acg1al2in48t6gkpkuconl55][error][yii\db\Exception] yii\db\Exception: Could not acquire a lock to save a revision for element 288 in /home/vindobona.wien/httpdocs/vendor/craftcms/cms/src/services/Revisions.php:78
Stack trace:
#0 /home/vindobona.wien/httpdocs/vendor/craftcms/cms/src/elements/Entry.php(1584): craft\services\Revisions->createRevision(Object(craft\elements\Entry), NULL, 'Applied \xE2\x80\x9CEntw...')
#1 /home/vindobona.wien/httpdocs/vendor/craftcms/cms/src/services/Elements.php(1141): craft\elements\Entry->afterPropagate(false)
#2 /home/vindobona.wien/httpdocs/vendor/craftcms/cms/src/services/Drafts.php(442): craft\services\Elements->duplicateElement(Object(craft\elements\Entry), Array)
#3 /home/vindobona.wien/httpdocs/vendor/craftcms/cms/src/controllers/EntryRevisionsController.php(441): craft\services\Drafts->publishDraft(Object(craft\elements\Entry))
#4 [internal function]: craft\controllers\EntryRevisionsController->actionPublishDraft()
#5 /home/vindobona.wien/httpdocs/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#6 /home/vindobona.wien/httpdocs/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#7 /home/vindobona.wien/httpdocs/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction('publish-draft', Array)
#8 /home/vindobona.wien/httpdocs/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction('publish-draft', Array)
#9 /home/vindobona.wien/httpdocs/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction('entry-revisions...', Array)
#10 /home/vindobona.wien/httpdocs/vendor/craftcms/cms/src/web/Application.php(577): craft\web\Application->runAction('entry-revisions...', Array)
#11 /home/vindobona.wien/httpdocs/vendor/craftcms/cms/src/web/Application.php(253): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#12 /home/vindobona.wien/httpdocs/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest(Object(craft\web\Request))
#13 /home/vindobona.wien/httpdocs/web/index.php(22): yii\base\Application->run()
#14 {main}

Additional info

craftedsystems commented 3 years ago

Same exception with this setup: • PHP version: 7.3.27 • Database driver & version: MySQL 5.6.51

brandonkelly commented 3 years ago

Not able to reproduce this on my end. Can you please send a database backup and your Composer files into support@craftcms.com, and point out which entry/draft you’re seeing this with?

ManiakMill commented 3 years ago

Hello. I have the same problem. Config:

craftedsystems commented 3 years ago

I did some tests with removing various plugins and found that since I removed the plugin Relations the exceptions are gone. I will keep an eye on the logs, but I hope that we can close this issue soon. 🤞

brandonkelly commented 3 years ago

That repo has been archived on GitHub so I wouldn’t hold my breath that the bug will be fixed. I just marked it as abandoned in the plugin store. Perhaps Reverse Relations will work better for you.