[wp-trac] [WordPress Trac] #57271: Cron unschedule / reschedule event errors

WordPress Trac noreply at wordpress.org
Wed May 1 07:26:53 UTC 2024


#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                        |  Resolution:
 Keywords:  needs-unit-tests needs-patch  |     Focuses:
------------------------------------------+------------------------------

Comment (by domainsupport):

 Replying to [comment:64 galbaras]:
 > This is happening on my sites now more than ever before, and likely
 means that some jobs are being missed, which could be causing unknown
 issues.

 We also noticed a recent increase / reappearance of this error on two of
 our larger sites. All occurrences coincided with extremely high traffic
 caused by DDoS / hackers. The spike in traffic caused very, very high load
 averages on the servers due to the huge strain on the database server. We
 finally resolved the issue by adding custom WAF rules in Cloudflare to
 challenge **all** non-UK (they are UK based sites) traffic that's not a
 known bot. This reduced the load on both servers and in turn allowed WP
 cron to reliably save the schedule to the database again.

 So three things ...

 1) I re-affirm my position that in the majority of cases this issue is
 caused by a problem with the database (whatever that might be) with the
 caveat that if your server fired cron is somehow firing twice in the same
 microsecond (as seems to the the case for @j3gaming) that will also cause
 the error but that's not something I've experienced

 2) If WP cron is unable to save to the `wp_options` table, then the
 chances are there are **many** other `INSERT` / `UPDATE` queries that have
 failed too ... just those fail silently

 3) If cron schedules are being
 [https://developer.wordpress.org/plugins/cron/scheduling-wp-cron-events
 /#scheduling-the-task added correctly] (checked that they exist and added
 if they don't) then WordPress should just add them again when it is once
 again able to which would mean that jobs may be late but they shouldn't be
 missed

 So, if you're seeing this error, it's almost certainly bigger than WP cron
 and I would take a look at your server's database / load / traffic ... or
 identify why your server fired cron is firing twice in the same
 microsecond as per @j3gaming case

 It might be that the solution here, rather than a patch, is to add a
 section to the "Dashboard - Tools - Site Health" that takes a look at the
 web / database servers to make sure they're not overloaded or low on RAM.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57271#comment:66>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list