magento2: Cronjobs increasing CPU usage and slow queries

Cronjobs stuck in pending state. CPU usage increasing. Mysql slow queries increasing.

image

Time is 13:28.

Logs filled with:

use magento;
SET timestamp=1579781526;
SELECT GET_LOCK('|CRON_GROUP_default', '5');
# Time: 200123 13:13:06
# User@Host: magento[magento] @ localhost []
# Thread_id: 20330  Schema: magento  QC_hit: No
# Query_time: 2.951003  Lock_time: 0.000000  Rows_sent: 1  Rows_examined: 0
# Rows_affected: 0
SET timestamp=1579781586;

Load goes down after disabling cronjob in crontab:

image

Preconditions (*)

Magento 2.3.3 & 2.4-develop PHP-FPM 7.2.24

Steps to reproduce (*)

  1. Install Magento
  2. Setup cron jobs
  3. Run store for a week
  4. Break store

Expected result (*)

Normal working store.

Actual result (*)

  1. Increased CPU usage
  2. Increased cronjobs count
  3. Increased slow queries
  4. Slow store

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (7 by maintainers)

Most upvoted comments

But you need to look at why they do not complete. It would be better if magento had some timeout to terminate stuck running jobs.

@roni-sooryen Happy to report that we still have nothing stuck 😃