Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zawilliams opened this issue Aug 15, 2024 · 9 comments
Assignees
Labels

Comments

@zawilliams
Copy link

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

@zawilliams zawilliams added the bug label Aug 15, 2024
@brandonkelly
Copy link
Member

Had you tried updating previously, and that failed for some other reason?

@zawilliams
Copy link
Author

No, not that I can pinpoint. Last update was just to bring Craft 4 up to date and that was no problem, right before doing the Craft 5 upgrade. I did notice that when restoring the database, I had forgotten to clear the queue table which did keep the migrations from happening at other places in the migration process, but once I made sure that was cleared each time things ran (after re-importing the database), it just always stopped at this particular migration (the solo_preview_targets one).

@brandonkelly
Copy link
Member

Can you try restarting your database server, reimporting a Craft 4 database backup, and upgrade again?

@zawilliams
Copy link
Author

Ok, so I tried restarting the database server and reimporting the Craft 4 database backup and upgraded again and same thing. Tried this both locally and on our staging server. Still the same thing on both (same issue as above).

@brandonkelly
Copy link
Member

Can you send your Craft 4 database and Composer files into support@craftcms.com?

@zawilliams
Copy link
Author

Sent! Thanks @brandonkelly.

@23d1
Copy link

23d1 commented Aug 18, 2024

Having the same issue, different error type(?)

*** failed to apply m240302_212719_solo_preview_targets

@zawilliams
Copy link
Author

Reached out to support and got everything upgraded. They suggested first upgrading to 5.1.0 and then after that upgrade from 5.1.0 to 5.3.x.

Good to go here. Thanks @brandonkelly. Curious if @23d1 will have success doing this as well.

@brandonkelly
Copy link
Member

Craft 5.3.5 is out with a fix for this 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants