WP 5.2 Site Health “Scheduled event has failed” action_scheduler_run_queue
-
Hi, I have recently upgraded to WordPress 5.2 using a default install of Woocommerce 3.6.3 (with no changes). When running the new Site Health checks the resulting report consistently shows that the Woocommerce cron job ‘action_scheduler_run_queue’ has failed to run. Can you shed any light?
-
Hi there,
That means that CRON is likely disabled in your web hosting environment; This is important as CRON jobs are responsible for the database tables to be updated following a plugin update.
Note that these can be run manually by following the steps outlined here: https://github.com/woocommerce/woocommerce/wiki/3.6.x-notes-FAQ#the-database-update-has-been-running-for-hoursis-not-completing
I pretty certain cron jobs aren’t disabled. It disappears if I visit the site and refresh the site health check. Could this be the case that cron jobs are only run when a visitor is hitting the site?
Hi @dgilfillan,
That is correct, WP Cron does not run continuously in the background, it only gets triggered by a page load, ie when you visit the site – https://developer.www.ads-software.com/plugins/cron/#what-is-wp-cron
Here is a good article if you would like to manage Cron from the server and not use WP Cron – https://pantheon.io/docs/wordpress-cron/
action_scheduler_run_queue is scheduled by Woocommerce to run every minute, so unless the site is being hit every minute it doesn’t run. What is the impact of this? Does it really need to run this often?
@dgilfillan long story short, WordPress Cron can’t normally manage more than a handful of events. There’s only a single database row that stores all of Cron data, and so Action Scheduler was built on top of it so that we can reliably manage hundreds or thousands of scheduled events on a single site. This was originally created for recurring subscription payments, but is now used for all event scheduling in WooCommerce and many of its extensions. The 1 minute interval is set to prevent additional delay, but no harm will be done if nobody visits the site at that time. The action should normally run whenever someone visits the site.
Now if action scheduler consistently fails to run, this means there must be an error triggered each time when some action is being processed. We’ve had reports of action scheduler errors after updating to WooCommerce 3.6, but these should be fixed now in 3.6.2 and newer:
https://github.com/woocommerce/woocommerce/issues/23373
Anyway, to find out what kind of error was triggered there exactly, and what’s the best way to fix it, you can go to WooCommerce > Status > Scheduled Actions, then filter for only Failed ones. If we’re lucky, the error message should appear in the Logs section on the right:
Screenshot: https://cld.wthms.co/t8Pz0v
If you send us the entire error message + a screenshot of the scheduled action, we can help you interpret the error and see what can be done. You can follow the instructions on https://snag.gy to capture and upload the screenshot.
Cheers!
Thanks for the response.
There are no failed scheduled actions and no failed errors – so that is good! It is simply the new WordPress site-health that flags up that the action is not running consistently. I guess then this is purely because the website is not hit every minute, and no harm is done, so please feel free to close the issue.
I have another strange problem with regard to Woocommerce System Status showing the below errors but I guess I will open a new thread for that:
Remote post: wp_remote_post() failed. Contact your hosting provider.
Remote get: wp_remote_get() failed. Contact your hosting provider.Thanks for your help.
Hey there!
Just ran into this. For whatever it’s worth, please know there’s a known issue with WP’s Site Health tool and “Scheduled Events” (or crons) – totally unrelated to the performance or integrity of WP plugins.
In short, WP’s Site Health tool works great when using WP_CRON. However, when using a Real Cron Job instead, you can expect errors like this one. If you’re using WP_CRON and still getting these errors, I would wait until WP fixes this problem. They are aware of it. Click here for details: https://core.trac.www.ads-software.com/ticket/47223
Cheers!
Hi,
I have created webhooks in WooCommerce that are triggered successfully.
The issue is that they are kept in ‘Pending State’ in the ‘Scheduled Actions’ queue. (i.e. I have to run them manually by clicking ‘run’ on each in the ‘Scheduled Actions’)The issue is a consequence of the failure of action_schedule_run_queue :
“The scheduled event, action_scheduler_run_queue, failed to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended”I am not sure how to solve this. If this is linked to the underlying cron of the webhosting provider or if this is to be fixed within WordPress.
If it is linked to webhosting cron, what kind of cron task should I trigger and how ?
Here are my current versions:
WordPress version: 5.3
WooCommerce version: 3.8.0Thanks a lot
JeromeIn regards to “Action_scheduler_run_queue scheduled event delayed, your site is still running, but this may indicate that scheduling posts or automatic updates may not work as required.”, This seems to be a known error when the plugin is not able to recognize the cron job on the server. It works great when using WP_CRON but any other crons might result in this error. I recommend contacting the plugin manufacturer to further investigate this issue. Please review the following article for more information. https://www.ads-software.com/support/topic/wp-5-2-site-health-scheduled-event-has-failed-action_scheduler_run_queue/
I am having the same problem: “action_scheduler_run_queue”
without any Failed Scheduled Actions or any type of error.Is WordPress team overwhelmed by the problem? Can we get a solution after ~1 year from when the ticket was opened?
All,
Please click here for more information on this topic.
Until plugin developers solve this issue, you can get rid of (or delay) the pesky message by using the filter provided below. You can add it directly to your functions.php file or use the plugin, Code Snippets, to accomplish the same.
add_filter('action_scheduler_run_schedule', function($arg) { return 86400; });
Hope this helps. Stay safe!
@jetxpert this fixed it for me. Thanks so very much!!! I appreciate you providing that code.
Thanks mate, that was very helpful
Thanx (@jetxpert)
It worked for me too!
I am having the same issue.
The failed scheduled event is wc_stripe_remove_order_locks.
The code up there doesn’t work in functions.php
- The topic ‘WP 5.2 Site Health “Scheduled event has failed” action_scheduler_run_queue’ is closed to new replies.