Job reserves by consumer before beanstalk return reply on producer's insert command

164 views
Skip to first unread message

Александр Рябов

unread,
Jan 22, 2021, 10:19:42 AM1/22/21
to beanstalk-talk
I found a bug. When producer adds a new job when consumer is running in parallel, beanstalk gives newly added job to consumer and returns reply to producer only after sent job to consumer.

Real behavior:
(0. Consumer is running;)
1. Producer adds job;
2. Beanstalk accepts job;
3. Consumer takes job;
4. Beanstalk returns reply about successful inserting job to producer.

Expected behavior:
(0. Consumer is running;)
1. Producer adds job;
2. Beanstalk accepts job and returning reply to producer;
3. Consumer takes job.

How to reproduce:
(1. Enable verbosity for beanstalk logging;)
(2. Run producer and consumer processes parallel;)
3. Send "put" command from your app by producer;
4. Watch log.

Screenshot from my log below
1611315344.jpg

kr

unread,
Jan 22, 2021, 11:22:43 PM1/22/21
to beanstalk-talk
On Fri, Jan 22, 2021 at 11:19 PM Александр Рябов <ar1...@gmail.com> wrote:
> I found a bug. When producer adds a new job when consumer is running
> in parallel, beanstalk gives newly added job to consumer and returns reply
> to producer only after sent job to consumer.

The protocol spec and the documentation for beanstalkd do
not specify an order in which these events must occur. The
implementation is free to choose. So I would say the observed
behavior conforms to the spec.

In general, it is good for specifications not to overly constrain
the software that implements them. They should specify only
what they need to, and otherwise leave implementations (such
as beanstalkd) free to choose an approach that suits them and
satisfies other constraints they may be facing.

That said, if you think it would be useful for the specification to
determine this ordering, we should weigh the trade-off of that
on the one hand vs letting the implementation retain more
flexibility on the other hand. Maybe we should update the spec.

Александр Рябов

unread,
Jan 25, 2021, 1:00:36 AM1/25/21
to beanstalk-talk
I think it will be useful because application can do something after adding job into queue. And I think that order when beasntalkd returns reply for producer before consumer take job will be logical

суббота, 23 января 2021 г. в 07:22:43 UTC+3, k...@xph.us:
Reply all
Reply to author
Forward
0 new messages