• First, I created a cron schedule called “minutely”. the interval is set to 60 (1 minute).

    I have a cron set to this schedule. It works for awhile. Eventually it’s deleted and stops working! That’s right, the entire cron event is gone (the schedule is still created)

    What could cause this?

    – – Edit – –

    Same as: https://ww.wp.xz.cn/support/topic/cron-job-disappears/

    Using WordPress 6.1.1, PHP 7.4.33

    • This topic was modified 3 years, 3 months ago by j3gaming.

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    I don’t have any more info to give you than what I wrote on that other thread – it’s likely that there’s a race condition or object cache issue somewhere that surfaces when events with this short interval are used. Please take a look through the plugin FAQ, there are several answers which cover related information.

    I recommend switching to a job queue with Action Scheduler which is built for this use case.

    Thread Starter j3gaming

    (@j3gaming)

    If that’s been 2 threads now, both with the same issue. Isn’t that strange? So nothing in your code ever removes cron events? (Other than the delete button manually)

    Does wordpress ever flag a cron to remove it entirely? If I was the only one with the issue I would let it go, but I also found a third thread here with another similar issue, and I could have continued to go back.

    Thread Starter j3gaming

    (@j3gaming)

    I re-created them yesterday, and now they are gone again this morning. How might I debug this? Any ideas?

    I’m having the same issue, which never happened before (the plugin was activated in 2020), but began occuring in about October of 2022. I’ve activated the Simple History plugin. Will that “catch” what is happening in the log?

    Thread Starter j3gaming

    (@j3gaming)

    I was able to capture some error logging. Not where it came from exactly.

    [17-Feb-2023 18:15:01 UTC] Cron reschedule event error for hook: crontrol_cron_job, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {“schedule”:”everyhour”,”args”:{“code”:”require_once(‘wp-content\/cron\/timesheet_data.php’);”,”name”:”Process Timesheet Data”},”interval”:3600}
    [17-Feb-2023 21:10:02 UTC] Cron reschedule event error for hook: wp_privacy_delete_old_export_files, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {“schedule”:”hourly”,”args”:[],”interval”:3600}

    https://ww.wp.xz.cn/support/topic/cron-unschedule-event-error-for-hook/

    • This reply was modified 3 years, 3 months ago by j3gaming.
    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Those “Cron reschedule event error for hook” error messages were added in WordPress 6.1. The error itself might not be a new one, but the extra errors checking and subsequent messages in your logs were added in 6.1.

    There’s some discussion about this here: https://core.trac.ww.wp.xz.cn/ticket/57271

    Thread Starter j3gaming

    (@j3gaming)

    @johnbillion Hey John, that ticket is similar, and helped me dig into it further. If anyone else posts about deleted crons, please have them provide as much info as they can here:

    https://core.trac.ww.wp.xz.cn/ticket/57924

    Your input on the expected flow of code would be extremely helpful since you have written a very popular cron plugin. Thanks!

    • This reply was modified 3 years, 2 months ago by j3gaming.
    Thread Starter j3gaming

    (@j3gaming)

    @johnbillion I think I have nearly tracked it down.

    https://core.trac.ww.wp.xz.cn/ticket/57924#comment:11

    In your case, your plugin could help insure crons that are removed/deleted/missing from the core are re-added.
    I’m going to guess that

    wp-admin/tools.php?page=crontrol_admin_manage_page

    Pulls a simple get_option(‘cron’) and displays it?

    My advice would be for your plugin to maintain it’s own database entries in a custom table. Then, that custom table checks against the core crons. Any missing ones, are then added again. This covers up a problem that has probably existed for awhile, but would ensure that anything added with the plugin, has to be deleted by the plugin.

    • This reply was modified 3 years, 2 months ago by j3gaming.
    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    I’ve not forgotten about this issue by the way, I’ve just not had time to investigate further. Hopefully soon.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Cron Being Deleted’ is closed to new replies.