Support » Plugin: WooCommerce » WP 5.2 Site Health “Scheduled event has failed” action_scheduler_run_queue

  • Resolved fippy

    (@dgilfillan)


    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?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support RK

    (@riaanknoetze)

    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?

    Plugin Support EtienneP

    (@etiennep)

    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.wordpress.org/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?

    Plugin Support madeincosmos

    (@madeincosmos)

    Automattic Happiness Engineer

    @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 http://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.wordpress.org/ticket/47223

    Cheers!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.