WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#41098 new defect (bug)

Some cron scheduling events are ignored

Reported by: bor0 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Cron API Keywords: has-patch dev-feedback
Focuses: Cc:

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.

Attachments (1)

41098-poc.diff (3.7 KB) - added by bor0 3 months ago.

Download all attachments as: .zip

Change History (4)

@bor0
3 months ago

#1 @bor0
3 months ago

  • Keywords has-patch dev-feedback added

#2 @bor0
3 months 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
3 months ago

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

Note: See TracTickets for help on using tickets.