Magento 2.3.1 – Fixing Cron Error: Serialization Failure 1213 Deadlock

cron

So we installed Magento 2.3.1 and some extensions. Nothing fancy. No data nothing. No errors until now.

Only every once per day we see the below error via our admin email. Can be any kind of job differs per day.

I am trying to understand why/how these jobs are leading to problems with cron if we arent really doing anything yet. This would appear a simple cron task to us.

How can we prevent this?

I dont believe truncating the tables is the solution as I have read somewhere … I mean the error would just re-occur some days later.

In Mysql.php line 589:

  SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to   
  get lock; try restarting transaction, query was: DELETE FROM `cron_schedule  
  ` WHERE (status = 'missed') AND (job_code in ('the_job_code', 'ebizm  
  arts_webhooks', 'jobs_clean_webhooks', 'jobs_clean_batches')) AND  
   (created_at < '2019-04-18 04:06:05')                                        

In Pdo.php line 235:

  SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to   
  get lock; try restarting transaction, query was: DELETE FROM `cron_schedule  
  ` WHERE (status = 'missed') AND (job_code in ('the_job_code', 'ebizm  
  arts_webhooks', 'jobs_clean_webhooks', 'jobs_clean_batches')) AND  
   (created_at < '2019-04-18 04:06:05')                                        

In Pdo.php line 228:

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


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

Best Answer

This issue is also logged here: https://github.com/magento/magento2/issues/22438

Related Topic