craftcms / cms

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

Deadlock issues with searchindex element save #3197

Closed timkelty closed 5 years ago

timkelty commented 6 years ago

Working on an app and consistently getting Deadlock errors on element save. I can reproduce this at will by opening up 3 or more entries and saving them all.

Past deadlock issues: https://github.com/craftcms/cms/issues/3003

Potentially relevant factors:

Here's the trace:

[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "2018-08-13 14:13:44 [52.144.33.220][2][99cbc881ca6170362a3239503bafa696][error][yii\db\Exception] PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction in /app/vendor/composer/yiisoft/yii2/db/Command.php:1258"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "Stack trace:"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#0 /app/vendor/composer/yiisoft/yii2/db/Command.php(1258): PDOStatement->execute()"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#1 /app/vendor/composer/yiisoft/yii2/db/Command.php(1075): yii\db\Command->internalExecute('INSERT INTO `se...')"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#2 /app/vendor/composer/craftcms/cms/src/services/Search.php(325): yii\db\Command->execute()"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#3 /app/vendor/composer/craftcms/cms/src/services/Search.php(137): craft\services\Search->_indexElementKeywords(1955, 'field', '167', 1, 'Rapid-Response ...')"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#4 /app/vendor/composer/craftcms/cms/src/services/Content.php(241): craft\services\Search->indexElementFields(1955, 1, Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#5 /app/vendor/composer/craftcms/cms/src/services/Content.php(201): craft\services\Content->_updateSearchIndexes(Object(craft\elements\Entry), Object(craft\models\FieldLayout))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#6 /app/vendor/composer/craftcms/cms/src/services/Elements.php(477): craft\services\Content->saveContent(Object(craft\elements\Entry))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#7 /app/vendor/composer/craftcms/cms/src/controllers/EntriesController.php(544): craft\services\Elements->saveElement(Object(craft\elements\Entry))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#8 [internal function]: craft\controllers\EntriesController->actionSaveEntry()"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#9 /app/vendor/composer/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#10 /app/vendor/composer/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#11 /app/vendor/composer/craftcms/cms/src/web/Controller.php(103): yii\base\Controller->runAction('save-entry', Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#12 /app/vendor/composer/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-entry', Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#13 /app/vendor/composer/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('entries/save-en...', Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#14 /app/vendor/composer/craftcms/cms/src/web/Application.php(538): craft\web\Application->runAction('entries/save-en...', Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#15 /app/vendor/composer/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#16 /app/vendor/composer/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#17 /app/vendor/composer/fusionary/craftcms-bootstrap/src/Bootstrap.php(76): yii\base\Application->run()"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#18 /app/public/index.php(3): fusionary\craftcms\bootstrap\Bootstrap::run('web')"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#19 {main}"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: ""
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "Next yii\db\Exception: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "The SQL being executed was: INSERT INTO `searchindex` (`keywords`, `elementId`, `attribute`, `fieldId`, `siteId`) VALUES (' rapid response support technicians on site 24 7 our remote hands technicians serve as an extended member of your in house team of experts to help deliver the highest standard of performance for your needs services are available on demand and can also be scheduled in advanced to support your business digital realty remote hands services perform a wide range of remote management and troubleshooting tasks to keep your data center up and running save time and resources 500x500 24x7 coverage 365 days a yearrapid response times for both business and after hours tailored to your site and specific needscontinuous delivery to ensure uninterrupted business operationsimplementation services available purple https dlr2018 fusionarydev com customer login customer portals are you looking for access to our portals click here to ...
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "mer service center provides trained technicians who can support your data center operations 24 7 at designated digital realty locations around the world on demand services many services are available on demand bulk purchase and subscription plans available at discounted hourly pricing examples of on demand services one time tape swaps tapes for backup systems are changed on requestpower cycling of equipment perform hard reboots or soft rebootspatch cord installation install patch cables based on customer directionequipment assistance assist with transport of large pieces of equipment within the data centerkvm availability provide screen outputs before and after reboots examples of scheduled services cross connect infrastructure install temporary loopbacks to verify physical media continuity from provider demarcation panel to the customer premises hand offequipment inventory detailed rack elevation drawings can be provideddeployment rac...
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "t support on site support for maintenance windows and other planned eventsrecurring events schedule routine events such as daily weekly monthly tape swaps versus opening a new service request each time learn more download our services brochure or remote hands brochure ', 1955, 'field', 167, 1) ON DUPLICATE KEY UPDATE `keywords`=' rapid response support technicians on site 24 7 our remote hands technicians serve as an extended member of your in house team of experts to help deliver the highest standard of performance for your needs services are available on demand and can also be scheduled in advanced to support your business digital realty remote hands services perform a wide range of remote management and troubleshooting tasks to keep your data center up and running save time and resources 500x500 24x7 coverage 365 days a yearrapid response times for both business and after hours tailored to your site and specific needscontinuous deli...
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "ailable purple https dlr2018 fusionarydev com customer login customer portals are you looking for access to our portals click here to login customer service for customer success 500x500 digital realty s customer service center provides trained technicians who can support your data center operations 24 7 at designated digital realty locations around the world on demand services many services are available on demand bulk purchase and subscription plans available at discounted hourly pricing examples of on demand services one time tape swaps tapes for backup systems are changed on requestpower cycling of equipment perform hard reboots or soft rebootspatch cord installation install patch cables based on customer directionequipment assistance assist with transport of large pieces of equipment within the data centerkvm availability provide screen outputs before and after reboots examples of scheduled services cross connect infrastructure ins...
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: " demarcation panel to the customer premises hand offequipment inventory detailed rack elevation drawings can be provideddeployment rack stack of equipment and structured cabling installationpre scheduled event support on site support for maintenance windows and other planned eventsrecurring events schedule routine events such as daily weekly monthly tape swaps versus opening a new service request each time learn more download our services brochure or remote hands brochure ' in /app/vendor/composer/yiisoft/yii2/db/Schema.php:664"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "Stack trace:"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#0 /app/vendor/composer/yiisoft/yii2/db/Command.php(1263): yii\db\Schema->convertException(Object(PDOException), 'INSERT INTO `se...')"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#1 /app/vendor/composer/yiisoft/yii2/db/Command.php(1075): yii\db\Command->internalExecute('INSERT INTO `se...')"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#2 /app/vendor/composer/craftcms/cms/src/services/Search.php(325): yii\db\Command->execute()"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#3 /app/vendor/composer/craftcms/cms/src/services/Search.php(137): craft\services\Search->_indexElementKeywords(1955, 'field', '167', 1, 'Rapid-Response ...')"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#4 /app/vendor/composer/craftcms/cms/src/services/Content.php(241): craft\services\Search->indexElementFields(1955, 1, Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#5 /app/vendor/composer/craftcms/cms/src/services/Content.php(201): craft\services\Content->_updateSearchIndexes(Object(craft\elements\Entry), Object(craft\models\FieldLayout))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#6 /app/vendor/composer/craftcms/cms/src/service"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "s/Elements.php(477): craft\services\Content->saveContent(Object(craft\elements\Entry))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#7 /app/vendor/composer/craftcms/cms/src/controllers/EntriesController.php(544): craft\services\Elements->saveElement(Object(craft\elements\Entry))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#8 [internal function]: craft\controllers\EntriesController->actionSaveEntry()"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#9 /app/vendor/composer/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#10 /app/vendor/composer/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#11 /app/vendor/composer/craftcms/cms/src/web/Controller.php(103): yii\base\Controller->runAction('save-entry', Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#12 /app/vendor/composer/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-entry', Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#13 /app/vendor/composer/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('entries/save-en...', Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#14 /app/vendor/composer/craftcms/cms/src/web/Application.php(538): craft\web\Application->runAction('entries/save-en...', Array)"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#15 /app/vendor/composer/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#16 /app/vendor/composer/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#17 /app/vendor/composer/fusionary/craftcms-bootstrap/src/Bootstrap.php(76): yii\base\Application->run()"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#18 /app/public/index.php(3): fusionary\craftcms\bootstrap\Bootstrap::run('web')"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "#19 {main}"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "Additional Information:"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "Array"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "("
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    [0] => 40001"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    [1] => 1213"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    [2] => Deadlock found when trying to get lock; try restarting transaction"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: ")"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: ""
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "2018-08-13 14:13:41 [52.144.33.220][2][99cbc881ca6170362a3239503bafa696][info][application] $_GET = []"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: ""
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "$_POST = ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'CRAFT_CSRF_TOKEN' => 'REDACTED'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'action' => 'entries/save-entry'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'redirect' => '167c6ea606e8496c3edda081db878c5cc3f40e61fad8d6dbb728cebcd20e069dentries/pages/{id}-{slug}/website'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'sectionId' => '12'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'entryId' => '1955'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'siteId' => '1'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'title' => 'Services'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'fields' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "        'subtitle' => 'Maximize Your Data Center Strategy and IT Resources'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "        'hero' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "        'sections' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            2375 => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'type' => 'chapter'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'enabled' => '1'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'fields' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'heading' => 'Rapid-Response Support, Technicians on site 24/7'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'text' => '<p>Our remote hands technicians serve as an extended member of your in-house team of experts to help deliver the highest standard of performance for your needs.</p>^M"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "<p>Services are available on-demand and can also be scheduled in advanced to support your business.</p>^M"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "<p>Digital Realty Remote Hands Services perform a wide range of remote management and troubleshooting tasks to keep your data center up and running. </p>'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'sectionEntries' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            2376 => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'type' => 'textAndImage'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'enabled' => '1'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'fields' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'heading' => 'Save Time and Resources'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'text' => '<ul><li>24x7 Coverage, 365 days a year</li><li>Rapid Response times for both business and after hours tailored to your site and specific needs</li><li>Continuous delivery to ensure uninterrupted business operations</li><li>Implementation Services available </li></ul>'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'image' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        0 => '1786'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'linkField' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'type' => 'entry'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'url' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'category' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'entry' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'customText' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'target' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'isCpFormData' => 'true'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'backgroundStyle' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            2377 => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'type' => 'cta'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'enabled' => '1'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'fields' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'heading' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'text' => '<p>Customer Portals: Are you looking for access to our Portals? Click here to Login.</p>'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'image' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'linkField' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'type' => 'entry'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'url' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'category' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'entry' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                            0 => '2150'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'customText' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'isCpFormData' => 'true'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'backgroundStyle' => 'purple'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'hasMatte' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            2378 => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'type' => 'textAndImage'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'enabled' => '1'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'fields' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'heading' => 'Customer Service for Customer Success'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'text' => '<p>Digital Realty’s Customer Service Center provides trained technicians who can support your data center operations, 24/7 at designated Digital Realty locations around the world.</p>'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'image' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        0 => '1786'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'linkField' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'type' => 'entry'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'url' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'category' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'entry' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'customText' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'target' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'isCpFormData' => 'true'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'backgroundStyle' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            2379 => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'type' => 'chapter'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'enabled' => '1'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'fields' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'heading' => 'On-Demand Services'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'text' => '<p>Many services are available On-Demand. Bulk purchase and Subscription plans available at discounted hourly pricing.</p>^M"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "<p> </p>^M"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "<p><strong>Examples of On-Demand Services:</strong></p>^M"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "<ul><li>One-time tape swaps: Tapes for backup systems are changed on request</li><li>Power cycling of equipment: Perform Hard Reboots or Soft Reboots</li><li>Patch cord installation: Install patch cables based on customer direction</li><li>Equipment assistance: Assist with transport of large pieces of equipment within the data center</li><li>KVM availability: Provide screen outputs before and after reboots</li></ul>^M"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "<p><strong>Examples of Scheduled Services:</strong></p>^M"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "<ul><li>Cross Connect Infrastructure: Install temporary loopbacks to verify physical media continuity from provider demarcation panel to the customer premises hand-off</li><li>Equipment Inventory: Detailed rack elevation drawings can be provided</li><li>Deployment: Rack & Stack of equipment and structured cabling installation</li><li>Pre-scheduled event support: On-site support for maintenance windows and other planned events</li><li>Recurring events: Schedule routine events such as daily/weekly/monthly tape swaps versus opening a new service request each time</li></ul>'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'sectionEntries' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            2380 => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'type' => 'cta'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'enabled' => '1'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                'fields' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'heading' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'text' => '<p>Learn more. Download our <a href=\"#\">Services Brochure</a> or <a href=\"#\">Remote Hands Brochure</a>.</p>'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'image' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'linkField' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'type' => 'entry'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'url' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'category' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "   "
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                     'entry' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'customText' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                        'isCpFormData' => 'true'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'backgroundStyle' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                    'hasMatte' => ''"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "                ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "            ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "        ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'typeId' => '38'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'slug' => 'services'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'parentId' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "        0 => '1837'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'author' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "        0 => '3'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    ]"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    'postDate' => ["
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "        'date' => '7/26/2018'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "        'timezone' => 'America/Detroit'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "        'time' => '2:59 PM'"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    [0] => 40001"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    [1] => 1213"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: "    [2] => Deadlock found when trying to get lock; try restarting transaction"
[13-Aug-2018 18:13:44] WARNING: [pool www] child 73 said into stderr: ")"
angrybrad commented 6 years ago

Is this MySQL or PostgreSQL? Any chance you could send a database dump over to support@craftmcs.com and point us to some entries we could save to try and reproduce?

timkelty commented 6 years ago

It's MySQL (on AWS RDS).

Yep, I'll send it over.

timkelty commented 6 years ago

@angrybrad sent a DB dump and step to reproduce!

larsboldt commented 6 years ago

Any updates on this? We are also experiencing deadlock issues related to "INSERT INTO searchindex".

timkelty commented 6 years ago

@larsboldt nothing yet, I pinged @angrybrad a couple days ago and he said it was till on his plate, though.

ccchapman commented 5 years ago

I receive a similar issue on some requests when rebuilding the search index.

SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction
The SQL being executed was: INSERT INTO `craft_searchindex` (`keywords`, `elementId`, `attribute`, `fieldId`, `siteId`) VALUES (' alternative energy ', 10991, 'slug', 0, 1) ON DUPLICATE KEY UPDATE `keywords`=' alternative energy '
timkelty commented 5 years ago

@ccchapman a few months back I was working with @angrybrad and he was able to reproduce it with my environment.

After you it happens once on a particular entry, if you save that same entry again, does it still occur? I think in our case, once the error occurred it wouldn't again for that same entry.

@angrybrad gave me some Mysql settings to play with to see if I could recreate, which I haven't tried yet. I'll try and do that next week.

timkelty commented 5 years ago

@ccchapman I haven't had any success, but I can confirm that for me at least, this only seems to happen once per entry.

After the exception is thrown, if I resave the same entry, all is well.

ccchapman commented 5 years ago

@timkelty For me it occurred when rebuilding the search index. Happened 50 times during a clear (through the ajax requests.) Not sure if expected.

jsunsawyer commented 5 years ago

I'm also experiencing this issue semi-regularly in a multi-site setup.

angrybrad commented 5 years ago

Have a potential fix for this here if someone who is able to reproduce would like to test.

You can change your composer.json to this to pull it in, then composer update:


"require": {
  "craftcms/cms": "dev-develop#79334a98a648681155c385e3adb8568127d32bde as 3.1.21",
  "...": "..."
}
jsunsawyer commented 5 years ago

@angrybrad I was able to consistently reproduce the issue by rebuilding the search index and attempting to re-save an entry.

Updating and testing the change seems to resolve the issue for me, though my error had not been a result of specifically rebuilding search indexes.

timkelty commented 5 years ago

@jsunsawyer, et. al –

Brad's fix remedied this for me! Haven't seen a deadlock error where I could consistently reproduce before. 🤞

angrybrad commented 5 years ago

Glad to hear!

my2ter commented 5 years ago

@brandonkelly / @angrybrad

Could we get the change in the 3.1 branch, please? Not willing to update to a beta / major version to get this fixed just yet.

Cheers

brandonkelly commented 5 years ago

@my2ter 79334a98a648681155c385e3adb8568127d32bde made it into Craft 3.1.22

my2ter commented 5 years ago

@brandonkelly Sorry my bad, I must have missed it.

Unfortunately, that means this bug is not fixed... I am testing 3.1.31 with commerce 2.1.2 and running 50VUs to load test my app and create orders end up with dead locks.

Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction
The SQL being executed was: INSERT INTO `craft_searchindex` (`elementId`, `attribute`, `fieldId`, `siteId`, `keywords`) VALUES (80638, 'slug', 0, 1, '')

I've narrowed it down to https://github.com/craftcms/cms/blob/3.1.31/src/services/Search.php#L113 after disabling most of my fields to be indexed in the search.

Commenting out line https://github.com/craftcms/cms/blob/3.1.31/src/services/Search.php#L113 and https://github.com/craftcms/cms/blob/3.1.31/src/services/Search.php#L116 will completely remove the dead lock issue.

Reason I'm mentioning commerce is because it would throw the deadlock for fields you cannot edit in the CMS and we had to implement an event hook to change the searched attributes:

Event::on(
    Element::class,
    Element::EVENT_REGISTER_SEARCHABLE_ATTRIBUTES,
    function (RegisterElementSearchableAttributesEvent $event) {
        if (in_array('sku', $event->attributes) || in_array('billingFirstName', $event->attributes)) {
            $event->attributes = [];
        }
});

and running a load test for a commerce app is more than common :)

@angrybrad FYI

my2ter commented 5 years ago

Hi,

Any news with this, please?

This dead lock issue is becoming really critical now for us. Even without considering a high load, this is now being triggered when two tasks run simultaneously...

Cheers

Craft 3.1.31

angrybrad commented 5 years ago

@my2ter Craft 3.2.0 RC3 offloaded updating search indexes on an element save to a job in the queue (https://github.com/craftcms/cms/blob/3.2/CHANGELOG-v3.md#320-rc3---2019-07-02) along with several other performance improvements in the element saving pipeline and 3.2 will likely be GA in the next week or two. Any chance you could try to reproduce on the 3.2 branch?

To test, change your craftcms/cms requirement in composer.json to:

"require": {
  "craftcms/cms": "^3.2.0-RC3",
  "...": "..."
}

Then run composer update.