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.
Problem
processLBSMessagesis called for a list of messages that were fetched from the LBS (or viaXPENDINGinrecoverUnackedMessages()). 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
pcallsrecoverUnackedMessages()and sees 2 messages that are un-acked.t=1 pod
qdoes the same.t=2 pod
pstarts processing message 1t=2 pod
qtries to acquire lock for message 1, finds out that it can't, and returns without trying to process message 2t=3 pod
pcrashesAt this point, pod
qwould 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.