cancel
Showing results for 
Search instead for 
Did you mean: 

How restart Cron jobs in a Magento Store Migration

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

How restart Cron jobs in a Magento Store Migration

I have migrated my Magento store 2.3.1 from the server. I have migrated database and folder with all files. What do I have to do with cron jobs? This is my error in logs:

 

[2019-11-19 11:21:16] main.ERROR: Cron Job indexer_update_all_views has an error: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: INSERT INTO `catalog_product_index_price_store` SELECT `ip_tmp`.* FROM `catalog_product_index_price_store_temp` AS `ip_tmp` ON DUPLICATE KEY UPDATE `tax_class_id` = VALUES(`tax_class_id`), `price` = VALUES(`price`), `final_price` = VALUES(`final_price`), `min_price` = VALUES(`min_price`), `max_price` = VALUES(`max_price`), `tier_price` = VALUES(`tier_price`). Statistics: {"sum":0,"count":1,"realmem":0,"emalloc":0,"realmem_start":170131456,"emalloc_start":157612720} [] []
[2019-11-19 11:21:16] main.CRITICAL: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: INSERT INTO `catalog_product_index_price_store` SELECT `ip_tmp`.* FROM `catalog_product_index_price_store_temp` AS `ip_tmp` ON DUPLICATE KEY UPDATE `tax_class_id` = VALUES(`tax_class_id`), `price` = VALUES(`price`), `final_price` = VALUES(`final_price`), `min_price` = VALUES(`min_price`), `max_price` = VALUES(`max_price`), `tier_price` = VALUES(`tier_price`) {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: INSERT INTO `catalog_product_index_price_store` SELECT `ip_tmp`.* FROM `catalog_product_index_price_store_temp` AS `ip_tmp` ON DUPLICATE KEY UPDATE `tax_class_id` = VALUES(`tax_class_id`), `price` = VALUES(`price`), `final_price` = VALUES(`final_price`), `min_price` = VALUES(`min_price`), `max_price` = VALUES(`max_price`), `tier_price` = VALUES(`tier_price`) at /var/www/magento/app/code/Bss/MultiStoreViewPricingPriceIndexer/Model/Indexer/Product/Price/Action/Rows.php:51, Magento\\Framework\\DB\\Adapter\\DeadlockException(code: 1213): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: INSERT INTO `catalog_product_index_price_store` SELECT `ip_tmp`.* FROM `catalog_product_index_price_store_temp` AS `ip_tmp` ON DUPLICATE KEY UPDATE `tax_class_id` = VALUES(`tax_class_id`), `price` = VALUES(`price`), `final_price` = VALUES(`final_price`), `min_price` = VALUES(`min_price`), `max_price` = VALUES(`max_price`), `tier_price` = VALUES(`tier_price`) at /var/www/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:589, Zend_Db_Statement_Exception(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: INSERT INTO `catalog_product_index_price_store` SELECT `ip_tmp`.* FROM `catalog_product_index_price_store_temp` AS `ip_tmp` ON DUPLICATE KEY UPDATE `tax_class_id` = VALUES(`tax_class_id`), `price` = VALUES(`price`), `final_price` = VALUES(`final_price`), `min_price` = VALUES(`min_price`), `max_price` = VALUES(`max_price`), `tier_price` = VALUES(`tier_price`) at /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/magento/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []

Any idea to fix that?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How restart Cron jobs in a Magento Store Migration

Hello @ManuelSissl,
As per your above error, issues with mysql time_out, when running indexing.

Solutions:
1. Truncate cron_schedule table from database.

2. Run Manual indexing through SSH.
php bin/magento indexer:reindex

 

3. Run cron jobs for rest of triggers.

bin/magento cron:run

NOTE : For more information for, how to setup cron, please refer this.

https://www.mageplaza.com/kb/how-to-configure-cronjob-schedule-tasks-magento-2.html

 

If my answer is useful, please Accept as Solution & give Kudos

View solution in original post

5 REPLIES 5

Re: How restart Cron jobs in a Magento Store Migration

Hello @ManuelSissl,
As per your above error, issues with mysql time_out, when running indexing.

Solutions:
1. Truncate cron_schedule table from database.

2. Run Manual indexing through SSH.
php bin/magento indexer:reindex

 

3. Run cron jobs for rest of triggers.

bin/magento cron:run

NOTE : For more information for, how to setup cron, please refer this.

https://www.mageplaza.com/kb/how-to-configure-cronjob-schedule-tasks-magento-2.html

 

If my answer is useful, please Accept as Solution & give Kudos

Re: How restart Cron jobs in a Magento Store Migration

So, you recommend Truncate cron_schedule table from database, and then what commands should I execute to launch the cron processes again?

Re: How restart Cron jobs in a Magento Store Migration

Hello @ManuelSissl ,

 

You can run cron jobs for rest of triggers.

php bin/magento cron:run

 Recommended, run manual indexing through SSH.

php bin/magento indexer:reindex

 

 

If my answer is useful, please Accept as Solution & give Kudos

Re: How restart Cron jobs in a Magento Store Migration

Sorry for my insistence, but today I change the server and I want to be sure of what I do. Once you have restored the database and moved all the files to the new server, I should do the following steps:

 

  • Truncate cron_schedule table from database
  • php bin/magento cron:install
  • php bin/magento cron:run
  • php bin/magento indexer:reindex

And nothing else, right? This way I delete everything in the cron table, and execute the command to create the cron tasks. Is all this correct?

Re: How restart Cron jobs in a Magento Store Migration

Hello @ManuelSissl 

 

As @Binod Yadav suggested, you will need to follow those steps.

For same issue same solution has been accepted here

https://community.magento.com/t5/Magento-2-x-Technical-Issues/Magento2-Serialization-failure-1213-De...

Was my answer helpful? You can accept it as a solution.
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer