My site health said cron evens has missed schedule, so I installed “Wp control” plugin to check the cron evens.
Normally “next run” will show the future time, but in my case it shows a time in the past like 6hours ago.
I’ve tried to disable all plugins, reinstall the Wordpress, clean the database, restart the server, the problem is still there.
After restart the server, I find out this happened right after a cron job ran, so each cron job will never run a second time because the next run will always be in the past!
Weird thing is there are 4 other Wordpress instances in the very same server and all 5 sites share the same php7.4 and MySQL, but their corn job is acting normally.
I’ve checked the date time settings, I’ve also tried to raise the number of php “max_children” and “start_servers” because some google results said it could be a php memory related issue, but still not able to solve this.
Please help me, how to debug a cron job issue like this and how to solve it?
Thank you for your attention!
My site health said cron evens has missed schedule, so I installed “Wp control” plugin to check the cron evens.
Normally “next run” will show the future time, but in my case it shows a time in the past like 6hours ago.
I’ve tried to disable all plugins, reinstall the Wordpress, clean the database, restart the server, the problem is still there.
After restart the server, I find out this happened right after a cron job ran, so each cron job will never run a second time because the next run will always be in the past!
Weird thing is there are 4 other Wordpress instances in the very same server and all 5 sites share the same php7.4 and MySQL, but their corn job is acting normally.
I’ve checked the date time settings, I’ve also tried to raise the number of php “max_children” and “start_servers” because some google results said it could be a php memory related issue, but still not able to solve this.
Please help me, how to debug a cron job issue like this and how to solve it?
Thank you for your attention!
Cron jobs in the past are cron jobs that have not had the opportunity to run yet.
Unless you system has a system level cron that is configured to trigger WP Cron at predictable intervals you won't be able to use WP Cron for precise timekeeping.
This is because WP Cron will be triggered when users visit in a non-blocking self request to wp-cron.php
, so if nobody visits your site, no cron jobs can run.
Perhaps WP_CRON
is set to false
in wp-config.php
? This is common on sites that rely instead on manually triggering cron via system cron.
Either re-enable it, or fix the system cron that was meant to manually trigger WP Cron
It could be that the next cron job due also causes a fatal error, preventing it from completing and holding up the queue. Check your error logs.
Normally WP Cron can only run for a short period before it runs into the same time limit that stops webpages from loading forever. Likewise it would have the same memory limits.
So if your site has a lot of jobs, it may not be able to process all of them in time. Likewise, a custom job may take too long and not have enough time to complete. Usually this will show up in a PHP error log as time limit or memory limit errors
Because WP Cron is triggered by a non-blocking request at the very end of a page load, if your page crashes/breaks at the very end it may not have the chance to make the request. If this happens after the footer you might not notice this happens