[wp-trac] [WordPress Trac] #15014: Cron : ONE scheduled hook may be executed several times

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 11 02:00:00 UTC 2011


#15014: Cron : ONE scheduled hook may be executed several times
-------------------------------+------------------------------
 Reporter:  arena              |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Cron               |     Version:
 Severity:  major              |  Resolution:
 Keywords:  reporter-feedback  |
-------------------------------+------------------------------

Comment (by arena):

 Replying to [comment:4 nacin]:
 > We need more information here.
 >
 > Race conditions in the cron API are very rare. Chances are your code is
 wrong.

 see #13158

 "The root problem is that we store the cron data in an array. A naive get,
 process, set algorithm will always be prone to race conditions.

 We can rework those scheduling functions to move as much of the processing
 before the get so that there's less time between the get and the set, but
 that won't solve the problem. Most of the bottleneck is probably in the db
 write, so reducing the time spent in PHP between get and set probably
 won't help that much.

 We could try putting in some locking (in the application layer) and maybe
 making a queue of stuff that needs to be added (one per row or we're back
 to where we started... transients?), but I don't think that will guarantee
 we prevent the race condition. More complicated and easy to just move the
 race condition from one area to another.
 "

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15014#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list