This issue applies to 7.x-2.x, 7.x-1.x, and 6.x-1.x.
The current BeanstalkdQueue::claimItem() implementation takes an argument that it describes as "$lease_time", and the phpdoc indicates that this argument controls the length of time the job will run prior to beanstalkd assuming that the worker has failed and pulling the job back into the queue for consumption by another worker. Now, there's a bug in all versions where this parameter isn't actually passed to pheanstalk, dating back to this commit; instead, it's hardcoded to pass 0.
Thing is though, that argument that's being passed isn't a lease time (what beanstalkd refers to as time to run, or TTR). TTR is controlled by the job producer, which is clear from the previous doc link (it's a param to put). The docs about reserve are a little confusingly worded, though, and may seem to leave open the possibility that the timeout val controls both TTR and the reserve timeout. If there's any doubt, have a look at this discussion, which shows (nicely, with pheanstalk AND reserve(0) calls) in the gdb dump of the server how the ttr for the claimed job is set to 60000000.
The actual function of the value passed to reserve (in fact, reserve-with-timeout) is to determine how long the beanstalkd server should make the worker block before releasing it with no job (if a job is not found in that time period). Pheanstalk's implementation uses NULL to indicate that no value should be passed (as the default value), which should also be the default value for this module's implementation of claimItem().
The attached patch changes the default value to NULL, ensures the param is passed to Pheanstalk, changes the name of the param and updates the phpdoc accordingly. It should be applied to all branches, though I only know that it applies easily to the 7.x-1.x branch.
| Comment | File | Size | Author |
|---|---|---|---|
| reserve-timeout.patch | 2.05 KB | sdboyer |
Comments
Comment #1
sdboyer commentedComment #2
sdboyer commentedi know html
Comment #3
sdboyer commentedComment #4
sdboyer commentedComment #5
drummComment #6
drummreserve-timeout.patch doesn't apply against 1.0-rc3, which we are running on Drupal.org. The first comment-only chunk is rejected. Attached is a patch that applies for us.
Comment #7
drummThis is working well.
Comment #8
mlhess commentedComment #12
gordon commentedThis has been applied to 6.x-1.x, 7.x-1.x and 7.x-2.x