azure-sdk-for-net: [BUG] Service Bus Message receiver removes message from queue but message is not received

Library name and version

Azure.Messaging.ServiceBus 7.6.0

Describe the bug

If there is already a message in the queue before the app starts the message is removed from the queue when ReceiveMessageAsync is called but the message is not returned so it is lost!

Subsequent messages are received.

This happens with all versions. It works fine locally.

Using Microsoft.Azure.ServiceBus also works fine.

Expected behavior

Message should be received

Actual behavior

Message is lost

Reproduction Steps

c# console app in kubernetes v1.21.7

add a message to the queue before the app is running

var _serviceBusClient = new ServiceBusClient(serviceBusConnectionString);
var _messageReceiver = _serviceBusClient.CreateReceiver(queuename);
var message = await _messageReceiver.ReceiveMessageAsync();

Environment

Azure Kubernetes v 1.21.7 .net 6 (same issue netcore3.1)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

If the receiver is actively receiving messages, then the DeliveryCount will be incremented as the receiver is able to settle the message. If the link is just open, but no receives are happening, the message will be released when it is delivered and it will not impact the delivery count.