cancel
Showing results for 
Search instead for 
Did you mean: 

Cron jobs returning DeadlockException, [Zend_Db_Statement_Exception] and [PDOException]

Cron jobs returning DeadlockException, [Zend_Db_Statement_Exception] and [PDOException]

When I run the following cron job:

Cron <xxx> /usr/local/bin/php /home/xxx/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/xxx/public_html/var/log/magento.cron.log

 

I get the following errors:

[Magento\Framework\DB\Adapter\DeadlockException]                                                                                                                
SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: DELETE FROM `qmhe_cron_schedule` WHERE (status = 'error') AND (job_code in ('ddg_automation_customer_subscriber_guest_sync', 'ddg_automation_importer', 'ddg_automation_status', 'ddg_automation_abandonedcarts', 'ddg_automation_reviews_and_wishlist', 'ddg_automation_campaign', 'ddg_automation_order_sync', 'ddg_automation_cleaner', 'ddg_automation_catalog_sync', 'ddg_automation_email_templates')) AND (created_at < '2018-09-14 04:30:11')  

[Zend_Db_Statement_Exception]                                                                                                                                                 
SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction, query was: DELETE FROM `qmhe_cron_schedule` WHERE (status = 'error') AND (job_code in ('ddg_automation_customer_subscriber_guest_sync', 'ddg_automation_importer', 'ddg_automation_status', 'ddg_automation_abandonedcarts', 'ddg_automation_reviews_and_wishlist', 'ddg_automation_campaign', 'ddg_automation_order_sync', 'ddg_automation_cleaner', 'ddg_automation_catalog_sync', 'ddg_automation_email_templates')) AND (created_at < '2018-09-14 04:30:11')  

[PDOException]                                                                                                   
SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction  

cron:run [--group GROUP] [--bootstrap BOOTSTRAP]

 

I see a few other posts in the forums about this but no solutions.

 

Any ideas?

1 REPLY 1

Re: Cron jobs returning DeadlockException, [Zend_Db_Statement_Exception] and [PDOException]

Hello @kayland,

 

Please restart MySQL service then open phpmyadmin and Truncate/empty qmhe_cron_schedule this table then Please run cron command

bin/magento cron:run [--group="<cron group name>"]

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