[wp-trac] [WordPress Trac] #17462: Improve cron locking

WordPress Trac wp-trac at lists.automattic.com
Tue May 17 07:27:46 UTC 2011

#17462: Improve cron locking
 Reporter:  ryan          |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Cron          |     Version:  3.1.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |

Comment (by duck_):

 Replying to [comment:4 Denis-de-Bernardy]:
 > Suppose you've a batch of 100k registration emails to send, and a fussy
 shared host that kills lengthy processes. Cron A locks and starts sending
 emails. The next couple of crons see things are locked so don't start.
 Server kills cron A because it's taking too long. Cron B locks and starts
 sending emails (to the same people). The next couple of crons see things
 are locked (etc.).

 The job is unscheduled before it's actually started off.

 Suppose you have three jobs 1, 2, 3 where 2 takes over a minute. I believe
 the problem is, Ryan correct me if I'm wrong, that when A is taking too
 long on 2 B can be spawned as the flag has timed out. That means that both
 A and B process job 3.

 As well as the longer time out period we could, as part of the loop in wp-
 cron.php, check the difference in time since the start and if it's
 approaching the lock time out then break. That means that processes that
 have taken too long stop as if they have died though I suppose they would
 clear the lock in doing so.

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

More information about the wp-trac mailing list