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

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:

Preconditions (*)
Magento 2.3.3 & 2.4-develop PHP-FPM 7.2.24
Steps to reproduce (*)
- Install Magento
- Setup cron jobs
- Run store for a week
- Break store
Expected result (*)
Normal working store.
Actual result (*)
- Increased CPU usage
- Increased cronjobs count
- Increased slow queries
- Slow store
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (7 by maintainers)
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 😃