question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Service Bus Message receiver removes message from queue but message is not received

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
JoshLove-msftcommented, Mar 14, 2023

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.

0reactions
et1975commented, Mar 14, 2023

If receiving in PeekLock mode, it would still be delivered to one of the receivers.

Even if MaxDeliveryCount is reached?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to receive some messages from Service Bus Queue
When you are using peekLock mode you observe that some of the messages are not received by your receiver application and restarting the...
Read more >
Some messages are getting deleted but not received - ...
It means that the moment a message is requested from the broker and delivered to the client, it will be immediately removed from...
Read more >
Azure Service Bus and its Complete Overview
Messages are sent to a topic in the same way they are sent to a queue, but messages are not received from the...
Read more >
azure-servicebus
RECEIVE_AND_DELETE mode removes the message from the queue on receipt. ServiceBusReceivedMessage messages returned from peek_messages() cannot be settled, as ...
Read more >
Azure Service Bus client library for .NET
Azure Service Bus provides flexible, brokered messaging between client and ... The receiver allows you to receive messages from a queue or subscription....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found