Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#41098 closed defect (bug) (duplicate)

Some cron scheduling events are ignored

Reported by: bor0's profile bor0 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Cron API Keywords: has-patch
Focuses: Cc:

Description (last modified by ocean90)

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.

Attachments (1)

41098-poc.diff (3.7 KB) - added by bor0 7 years ago.

Download all attachments as: .zip

Change History (5)

@bor0
7 years ago

#1 @bor0
7 years ago

  • Keywords has-patch dev-feedback added

#2 @bor0
7 years ago

I was told there is a possibility a similar issue exists (https://wordpress.slack.com/archives/C02RQBWTW/p1497894482517202?thread_ts=1497891360.458419&cid=C02RQBWTW) but I couldn't find it when searching.

If that turns out to be the case, please close this as duplicate.

Otherwise, I provided a proof of concept diff.

#3 @swissspidy
7 years ago

I think #13158 is the one I was referring to. See also #15148.

#4 @ocean90
6 years ago

  • Description modified (diff)
  • Keywords dev-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version 4.9 deleted

Duplicate of #39924 and #13158.

Note: See TracTickets for help on using tickets.