Skip to content

[5.x]: Upgrading from 4 -> 5 applying m240302_212719_solo_preview_targets Exception: 1205 Lock wait timeout exceeded; #15539

@zawilliams

Description

@zawilliams

What happened?

Description

I'm upgrading from Craft 4 to 5 and have followed the upgrade guide and when I go to run composer update, during migrations I get:

*** applying m240302_212719_solo_preview_targets
Exception: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction
The SQL being executed was: INSERT INTO `elements_bulkops` (`elementId`, `key`, `timestamp`) VALUES (3265, 'lmbablaldo', '2024-08-15 05:18:49') ON DUPLICATE KEY UPDATE `timestamp`=VALUES(`timestamp`) (/var/www/html/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1325): yii\db\Schema->convertException()
#1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute()
#2 /var/www/html/vendor/craftcms/cms/src/helpers/Db.php(1079): yii\db\Command->execute()
#3 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1179): craft\helpers\Db::upsert()
#4 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3802): craft\services\Elements->trackElementInBulkOps()
#5 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1201): craft\services\Elements->craft\services\{closure}()
#6 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3575): craft\services\Elements->ensureBulkOp()
#7 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1287): craft\services\Elements->_saveElementInternal()
#8 /var/www/html/vendor/craftcms/cms/src/services/Entries.php(955): craft\services\Elements->saveElement()
#9 /var/www/html/vendor/craftcms/cms/src/services/Entries.php(836): craft\services\Entries->_ensureSingleEntry()
#10 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(1816): craft\services\Entries->handleChangedSection()
#11 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(1179): craft\console\Application->craft\base\{closure}()
#12 [internal function]: craft\services\ProjectConfig->handleChangeEvent()
#13 /var/www/html/vendor/yiisoft/yii2/base/Component.php(641): call_user_func()
#14 /var/www/html/vendor/craftcms/cms/src/models/ProjectConfigData.php(85): yii\base\Component->trigger()
#15 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(564): craft\models\ProjectConfigData->commitChanges()
#16 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(524): craft\services\ProjectConfig->_setInternal()
#17 /var/www/html/vendor/craftcms/cms/src/services/Entries.php(597): craft\services\ProjectConfig->set()
#18 /var/www/html/vendor/craftcms/cms/src/migrations/m240302_212719_solo_preview_targets.php(38): craft\services\Entries->saveSection()
#19 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(50): craft\migrations\m240302_212719_solo_preview_targets->safeUp()
#20 /var/www/html/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(758): craft\db\Migration->up()
#21 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(382): yii\console\controllers\BaseMigrateController->migrateUp()
#22 [internal function]: craft\console\controllers\MigrateController->actionAll()
#23 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#24 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#25 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction()
#26 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(195): yii\console\Controller->runAction()
#27 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): craft\console\controllers\MigrateController->runAction()
#28 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction()
#29 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction()
#30 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(212): craft\console\Application->runAction()
#31 /var/www/html/vendor/craftcms/cms/src/console/Controller.php(207): yii\base\Controller->run()
#32 /var/www/html/vendor/craftcms/cms/src/console/controllers/UpController.php(60): craft\console\Controller->run()
#33 [internal function]: craft\console\controllers\UpController->actionIndex()
#34 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#35 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#36 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction()
#37 /var/www/html/vendor/craftcms/cms/src/console/ControllerTrait.php(89): yii\console\Controller->runAction()
#38 /var/www/html/vendor/craftcms/cms/src/console/Controller.php(216): craft\console\Controller->traitRunAction()
#39 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction()
#40 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction()
#41 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction()
#42 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction()
#43 /var/www/html/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest()
#44 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest()
#45 /var/www/html/craft(13): yii\base\Application->run()
#46 {main}
*** failed to apply m240302_212719_solo_preview_targets (time: 50.264s)

I've re-imported the database and tried running this at least 8 times. Kept trying to see if it would work if I changed something different each time.

Any thoughts?

Steps to reproduce

Run composer update after going through the upgrade guide and it happens during migrations and always stops at this point.

Expected behavior

I expect migrations to finish.

Actual behavior

Migrations stop and I have to re-import the database.

Craft CMS version

5.3.4

PHP version

8.3

Operating system and version

No response

Database type and version

MySQL 8.0.33

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions