Skip to content

processLBSMessages should not return immediately if grabbing the mutex fails for one message #56

@a3y3

Description

@a3y3

Problem

processLBSMessages is called for a list of messages that were fetched from the LBS (or via XPENDING in recoverUnackedMessages()). Currently, from the list of messages, if a single lock fails to be acquired, the function returns before processing the other messages. The most common event in which the lock can fail to be acquired is if some other pod has acquired the lock for the message.

However, the other messages should be given an opportunity to be processed. Consider the following sequence of events:
t=0 pod p calls recoverUnackedMessages() and sees 2 messages that are un-acked.
t=1 pod q does the same.
t=2 pod p starts processing message 1
t=2 pod q tries to acquire lock for message 1, finds out that it can't, and returns without trying to process message 2
t=3 pod p crashes

At this point, pod q would have been able to grab message 2, but now it never will.

As I write this, I realize that it's a bit of an unlikely scenario, but I don't see the problem with trying to process all messages, if grabbing the lock fails for only one message.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions