[wp-trac] [WordPress Trac] #57271: Cron unschedule / reschedule event errors
WordPress Trac
noreply at wordpress.org
Sun Dec 4 09:55:55 UTC 2022
#57271: Cron unschedule / reschedule event errors
---------------------------+-----------------------------
Reporter: domainsupport | Owner: audrasjb
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Cron API | Version: 6.0
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
Multiple users have reported errors since v6.0 across installs with
completely different themes and plugins ...
{{{
[09-Nov-2022 11:28:28 UTC] Cron unschedule event error for hook: do_pings,
Error code: could_not_set, Error message: The cron event list could not be
saved., Data: {“schedule”:false,”args”:[]}
[09-Nov-2022 18:05:03 UTC] Cron unschedule event error for hook:
wordfence_processAttackData, Error code: could_not_set, Error message: The
cron event list could not be saved., Data: {“schedule”:false,”args”:[]}
[21-Nov-2022 07:53:04 UTC] Cron reschedule event error for hook:
wf_scan_monitor, Error code: could_not_set, Error message: The cron event
list could not be saved., Data:
{“schedule”:”wf_scan_monitor_interval”,”args”:[],”interval”:60}
[21-Nov-2022 07:53:04 UTC] Cron unschedule event error for hook:
wf_scan_monitor, Error code: could_not_set, Error message: The cron event
list could not be saved., Data:
{“schedule”:”wf_scan_monitor_interval”,”args”:[],”interval”:60}
}}}
There are many more examples on the support thread
https://wordpress.org/support/topic/cron-unschedule-event-error-for-hook/
I have so far been unable to find a way to manually re-produce this issue
but this is what I have discovered so far ...
So this error happens when `wp_unschedule_event()` and
`wp_reschedule_event()` fails.
`could_not_set` error is presented by` _set_cron_array()` which is the
return function for `wp_unschedule_event()` and `wp_schedule_event()`.
`could_not_set` error is returned by `_set_cron_array()` when the updating
of the cron table fails with `update_option( 'cron', $cron );`.
`update_option()` fails when …
1) The `$option` parameter is empty
This should never happen
2) The old option value is the same as the new option value
This suggests the cron job is running more than once but may not be the
only reason ... ?
3) The database insert query `$wpdb->update()` fails
This is a bit worrying but shouldn’t be the case as surely there should be
an accompanying database error?
I think we can rule out (1) seeing as the `$option` parameter is never
empty.
We can maybe rule out (2) because from the thread above, this happens on
high traffic sites as well as low traffic sites and on sites using the
default wp-cron firing as well as cron fired by the system … ?
The leaves (3) being the most likely cause of the "bug".
I have tried to assign to @audrasjb (I hope that's OK to do?) because they
added the commit on the 20th September that started to highlight the issue
https://github.com/WordPress/WordPress/commit/84d19848666a81584e0007a6ab7f7ad3c990d71a
I realise that this is not going to be easy to diagnose until the issue
can be manually replicated but I think it should be looked into.
Oliver
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57271>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list