Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#15670 closed defect (bug) (duplicate)

Don't allow multiple schedulings of the same job.

Reported by: sexytyranno's profile sexytyranno Owned by:
Milestone: Priority: normal
Severity: major Version: 3.0.1
Component: Cron API Keywords:
Focuses: Cc:

Description

I may be mistaken here, since I'm not that familair with WP's cron system, but from the MySQL query log (which managed to fill up the server due to this and a bad plugin), it looks like WP is allowing cron jobs to be scheduled with the same contents repeatedly.

I do believe that WP should, under all circumstances, check to see if a job matching the newly scheduled job already exists. If it does, then don't schedule it twice, as this could have catastrophic results.

WP Version: 3.0.1
Socialize This Version: 2.0.3

The bad code that caused this was in the socialize-this plugin:

if(wp_get_schedule('cron_update_expiry_date') == FALSE){
    wp_schedule_event(time(), 'hourly', 'updateSocialized');
}

The below is the first KB or so from the 0.5MB UPDATE SQL command that resulted from this.

UPDATE wp_options SET option_value = 'a:3423:{i:1291407189;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407190;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407191;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407192;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407193;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407194;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407196;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407197;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407199;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407200;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407201;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407202;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407203;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407204;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval\";i:3600;}}}i:1291407205;a:1:{s:16:\"updateSocialized\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:6:\"hourly\";s:4:\"args\";a:0:{}s:8:\"interval

Change History (2)

#1 @sexytyranno
13 years ago

  • Severity changed from normal to major

Bumped the severity up a bit after thinking about it. When unchecked, this has the capability to take down a MySQL server completely on a high traffic site. Yikes.

#2 @duck_
13 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

See #15670, especially this comment

Note: See TracTickets for help on using tickets.