9

I'm having issues with Azure Message Bus Queues.

I'm having MessageLockLostException thrown and The request operation did not complete within the allotted timeout of 00:01:10. The time allotted to this operation may have been a portion of a longer timeout.

I've set my queue into ReceiveMode.PeekLock.

I also check

if(message.LockedUntilUtc.Minute <= 1)
    message.RenewLock();

Why would this happen, what's causing the lock to give out? I was reading somewhere from the point where you Receive you have 5 minutes by default. This process takes a little longer usually. I wanted to renew the lock but this isn't working too well.

Jim Aho
  • 9,932
  • 15
  • 56
  • 87
Styles
  • 515
  • 2
  • 6
  • 16
  • Is it me or does your message not tell you your lock timeout is 1:10 (70 seconds)? That configuration is set when the queue is created. – Peter Ritchie Mar 08 '13 at 22:35

1 Answers1

20

The LockDuration is property of the Queue. You typically set this when you create the Queue. This is Queue level property and cannot be changed on a message base. What you've read, most probably is saying that this duration cannot be longer than 5 minutes. The default value is 1 Minute, that's why you face issues. And why you face it 70 seconds later - I assume the logic for checking this conditions is executed every 10 seconds.

So I suggest that you create or modify your Queue to set LockDuration property to 5 minutes. Then, while working RenewLock of your message when appropriate.

astaykov
  • 30,768
  • 3
  • 70
  • 86
  • 1
    Ah, thank you! That makes more sense! For additional information: QueueDescription is where LockDuration exists. – Styles Mar 09 '13 at 02:14
  • 2
    As a side note, the default value when you create a queue from the management portal is 30 seconds. – ken2k May 06 '15 at 16:27
  • 2
    As a side note for people seeing this type error working with topics. There's a lock duration on the subscriber level which fixes. – jasonoriordan Nov 12 '18 at 08:42