Support » Plugin: WP-Cron Status Checker » WP Cron failed to complete

  • Resolved taastrategies

    (@taastrategies)


    I have been receiving WP Cron Failed To Complete emails daily for about 10 days now for a single cron event:

    mepr_reminders_worker (A MemberPress plugin event. MP not experiencing this on other sites)

    Failure occurs with every cron execution.

    The Cron Status for the last 3 runs typically reports a half dozen cron events completed and one failure for mepr_reminders_worker.

    I’ve consulted with both MP and our host, Siteground. We’ve completed all of the troubleshooting we can think of:

    * replaced the WP cron with server based cron executing every half hour
    * enabled PHP_errorlog for logging

    The host cron runs every half hour like clockwork and is confirmed by Cron Status which continues to show the single failure. PHP_errorlog contains just two older messages and no cron event failures are being posted.

    Need some help on this please.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author webheadcoder

    (@webheadllc)

    Hi,

    Thank you for investigating the problem and trying things out before posting. I appreciate it.

    If I’m looking at the same MemberPress plugin (version 1.2.4), it looks like the the “worker” function is hooked into the mepr_reminders_worker event. In the worker function it sets the PHP execution time limit to 0 which is unlimited. It then sets its own time limit to 10 minutes.

    There are a few things that could be happening:
    1) Your host’s php.ini file could be preventing the time limit from being set. If your host’s php.ini file is preventing the code from setting it’s own time limit the cron job could be timing out and so WP-Cron Status Checker never gets notified that it’s done running. I think the timeout would probably show up in your PHP error log so this is the most unlikely case.

    2) The worker function may actually be taking up to 10 minutes to run. If that’s the case you may get an email because the cron did not finish within 1 minute. The log should be updated after the 10 minutes to show a success. Are you able to see the log on the Tools->WP Cron Status page 10 minutes after it runs?

    3) Something might be wrong with this plugin. This plugin is still very young, so I apologize in advance if it isn’t correctly detecting a completed cron. I just updated the plugin today with a new filter called ‘wcsc_skip_hook’. If you find everything in the MemberPress plugin is working correctly you can add the hook name to your theme’s functions.php file:

    function my_skip_hook_function( $skip_hook, $hook_name ) {
        if ( $hook_name == 'mepr_reminders_worker' ) {
            $skip_hook = true;
        }
        return $skip_hook;
    }
    add_filter( 'wcsc_skip_hook', 'my_skip_hook_function', 10, 2 );

    In the near future this will be an option in the plugin’s settings page.

    I’d also be happy to look into the code a little more on your website if you are ok with sending me admin credentials. I don’t normally do this with the free plugin, but I’m eager to improve this plugin. You can send me the credentials at my email: corey @ webheadcoder.com without the spaces.

    Thank you for the quick response. Overnight, Siteground provided a log which shows no problem with the cron execution and I’d still not gotten any emails.

    I installed the WP Cron Status update immediately. The cron has been through 2 half hourly updates with no failures for mepr_reminders_worker which shows completed in 6.1. Unless failures begin appearing again, it looks like the problem is solved.

    The folks at MemberPress have tried to help with this. Please let me know if there is anything I should pass along to them.

    Ooops! The mepr_reminders_worker has shown completed for the past 3 cron executions but the last execution shows a failure for UpDraftPlus. (UpDraftPlus subsequently completed its backup run.) This suggests that there is a problem with the status checker. I’d be happy to open an admin window for you if you’ll give me a range. I can also temporarily increase the cron frequency.

    Also, here are comments from MemberPress regarding your 3 options:

    1) I agree this is likely not the case as the error logs are empty, and the reminders are sending just fine.

    2) Our worker function will exit once there’s no more reminders to send. It will not run for 10 minutes if there’s nothing to do. In your last test case, there was just the one abandoned signup reminder to send – so it should have completed within a few seconds.

    3) This looks like it will just ignore the completion status, rather than attempt to detect it properly. It could be fine if he’s not able to find any reason for it showing as a failure.

    Plugin Author webheadcoder

    (@webheadllc)

    Thank you for the update and MemberPress’ feedback.

    If you’re talking about a range of time I’m available to investigate your website, I’ll be available today at 5pm – 8pm HST. If that doesn’t work for you please email me a time that works for you.

    Plugin Author webheadcoder

    (@webheadllc)

    v1.2 is out and should resolve this issue.. sort of.

    Just reiterating what I talked about in our emails so others can know what to do if they’re having this problem:

    v1.2 will mark those pesky updraft plus crons as “incomplete”. This is basically because no errors are thrown and it does not finish through the normal PHP process.

    By default these incomplete statuses are treated as errors because version 1.0 and 1.1 treated them as errors. You can go to the Settings -> WP Cron Status Checker page and check the checkbox that says: “Consider incomplete statuses to not be an error for all hooks”.

    Thank you for the followup. I look forward to trying out 1.2. You might consider using plugin specific overrides rather than global.

    Plugin Author webheadcoder

    (@webheadllc)

    Oh, yes. The PRO version allows you to specify which hooks should consider statuses to not be errors.

    Marking this as resolved, reply if you still get failure emails when the cron completes. Thanks for all your cooperation and patience!

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