[Service Bus] Throw LockLostError when AMQP link not alive#2828
[Service Bus] Throw LockLostError when AMQP link not alive#2828ramya-rao-a merged 3 commits intoAzure:masterfrom
Conversation
|
An alternative is to use a new error code say
|
|
fyi, live tests are all green The code changes in this PR are ready for review. But this need not block the merging of this PR. If we do decide to go with |
| * The lock held on the message by the receiver is let go, making the message available again in | ||
| * Service Bus for another receive operation. | ||
| * | ||
| * - Throws `SessionLockLostError` (for messages from a Queue/Subscription with sessions enabled) |
|
Hi @ramya-rao-a we're seeing this a bit now. What is the recommended best practice for working around this error - or handling it properly? Currently we're seeing messages being processed multiple times, because they're able to be received, but not completed (by auto-complete). Should we turn off auto complete, complete manually, catch the error and then abandon the message? Any guidance on best practice here would be hugely appreciated! Thank you |
|
@SamJarmanPP Are you seeing the LockLostError or the ServiceUnavailableError? |
|
@ramya-rao-a we're seeing |
|
To settle (complete/abandon/defer/deadletter) a message, we need to use the same underlying AMQP receiver link which was used to receive the message. When this link cannot be found, we throw the There are a couple of scenarios where we fail to find the AMQP link
Next step would be to confirm which of the above category are you falling in. You can confirm right away whether or not you fall under either of the first 2 categories. Set the environment variable DEBUG to Look for lines starting with |
|
Hi @ramya-rao-a, thanks for the detailed response! Hugely appreciated. I think we can rule out #1 for sure. As for #2, yes we were receiving messages still (to the point they failed to complete We haven't seen this error since the day it occurred in our environment, so I can try enable logs but I doubt if we'll ever catch one :( Another clue from our stack trace below is the retryable: false, which leads me to believe it might be #2 somehow, but #3 sounds more right. You might gather more from this trace than I? (Sorry it was not source mapped properly) |
|
The error This is not the case of case number 2 |
|
@ramya-rao-a you may have lost me there sorry! But I will put in the logs and see if theres anything to report in a few days :) |
|
:) Feel free to log a new issue and mention me with what you have |
|
Hello @ramya-rao-a we are facing with the same issue as @SamJarmanPP we are still investigating to see which one of the three provided scenarios is the one happening to us, at the moment I think it's probably the third one. In case this is the problem what would be the best way to handle this error? Thanks. |
Offshoot from #2761
An AMQP receiver link may die due to errors from service or network loss or due to user closing the receiver object. Messages received from such links can no longer be settled. We throw a generic error for such cases.
In the spirit of #2658, this PR makes the below changes
SesisonLockLostErrororMessageLockLostErrorfor above casesThe reason to chose the LockLostError is because the minute the AMQP receiver link dies, the service releases the lock on the message/session