Azure Service Bus queue messages got stuck

2019-02-12 19:42发布

问题:

I recently created some partitioned queues from where I send and receive all the time. They've run as non-partitioned in the past without any of my current issues.

The problem is, I have a constant number of messages in the queue that I can not receive. I always get nothing back when not sending any other messages to the queues but when I send messages to the queues I receive the new messages without a problem. The messages that are stuck in the queue are active messages, not dead lettered.

I'm suspecting they're stuck in a specific partition(s) but I don't know how to receive them.

Since I cannot receive these messages is there way to reset the ServiceBus Queue?

Any ideas?

Update:

The number is not constant but very slowly increasing. On our testing environment we receive little more than 2000 messages per hour and the queues, after being reset to 0 (zero) has received around 20 messages each in the last 12 hours. Those messages are just there but not receivable. At least not in the usual way.

The issue is only in two namespaces after they have been partitioned. The issue is not in our live environment where we don't use partitioned queues.

回答1:

I have seen a similar thing in our production env - maybe its the same behavior you are seeing. Using ServiceBusExplorer or something similar, check if the message's 'ContentType' = application/vnd.ms-servicebus-ping.

If so... this is a (Azure) system generated message to determine queue availability... as far as I know these messages are supposed to disappear after they are received... but mine do not either. The documentation from MS is sparse on this stuff...

In any case, if you make sure that this is the cause, you can at least rest assured that they are not YOUR messages that are stuck in ServiceBus purgatory. Hopefully MS fixes this soon...



回答2:

Check the lock duration of your queue. If the Messages had been received but not marked as Complete() they seem to be "stuck" (not receivable) until the lock releases the Message again.