[wp-trac] [WordPress Trac] #39924: wp_schedule_single_event is possibly failed to schedule a task when it is called concurrently

WordPress Trac noreply at wordpress.org
Tue Feb 21 09:21:53 UTC 2017


#39924: wp_schedule_single_event is possibly failed to schedule a task when it is
called concurrently
--------------------------+-----------------------------
 Reporter:  hainey        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.6
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In some occaltionally case, we found the wp_schedule_single_event was
 called, but the event did not happen.

 At last we find the possible reason is in wp_schedule_single_event
 function

 $crons = _get_cron_array();

 ...
 $crons[$event->timestamp][$event->hook][$key] = ...

 _set_cron_array( $crons );


 If we have two threads calling wp_schedule_single_event at the same time,
 it could be possible only one cron event is overwritten by another thread.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39924>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list