[wp-trac] [WordPress Trac] #41098: Some cron scheduling events are ignored
WordPress Trac
noreply at wordpress.org
Sun Nov 12 15:07:06 UTC 2017
#41098: Some cron scheduling events are ignored
--------------------------+------------------------
Reporter: bor0 | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Cron API | Version:
Severity: normal | Resolution: duplicate
Keywords: has-patch | Focuses:
--------------------------+------------------------
Changes (by ocean90):
* status: new => closed
* version: 4.9 =>
* milestone: Awaiting Review =>
* keywords: has-patch dev-feedback => has-patch
* resolution: => duplicate
Old description:
> The problem appears when two different events are scheduled at the same
> time.
>
> It's a bit hard to reproduce, but if one plugin is continuously
> scheduling events (e.g. recurrent schedule every 5 mins, but they execute
> for 5 mins), another plugin's scheduling events might be completely
> ignored.
>
> I believe this is because there is no lock mechanism in the schedule
> functions where we write to the `cron` option in the database.
>
> What happens in the code is:
>
> Continuous (plugin #1): wp-cron.php has `wp_unschedule_event` in a loop
> (which may overwrite `cron` option in the database)
>
> Random (plugin #2): Call `wp_schedule_event` to update `cron` option, but
> plugin #1 may have overwritten it already.
New description:
The problem appears when two different events are scheduled at the same
time.
It's a bit hard to reproduce, but if one plugin is continuously scheduling
events (e.g. recurrent schedule every 5 mins, but they execute for 5
mins), another plugin's scheduling events might be completely ignored.
I believe this is because there is no lock mechanism in the schedule
functions where we write to the `cron` option in the database.
What happens in the code is:
Continuous (plugin !#1): wp-cron.php has `wp_unschedule_event` in a loop
(which may overwrite `cron` option in the database)
Random (plugin !#2): Call `wp_schedule_event` to update `cron` option, but
plugin !#1 may have overwritten it already.
--
Comment:
Duplicate of #39924 and #13158.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41098#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list