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] ServiceBusRetryOptions seems to be not working

See original GitHub issue

Library name and version

Azure.Messaging.ServiceBus 7.6.0

Describe the bug

We recently experienced ServiceBus issues where after receiving a bunch of ServiceTimeout exceptions noticed in application insights no retries.

We have ServiceBusRetryOptions setup as follows for our client:

var serviceBusClientOptions = new ServiceBusClientOptions()
            {
                RetryOptions = new ServiceBusRetryOptions()
                {
                    MaxRetries = 5,
                    Mode = ServiceBusRetryMode.Exponential,
                    MaxDelay = TimeSpan.FromSeconds(30),
                    TryTimeout = TimeSpan.FromSeconds(30)
                }
            };

And in application insights it is shown to only have taken 30s. timeout

Expected behavior

Expect request duration to be longer as it should include all 5 retries.

Actual behavior

Request seems to return ServiceTimeout exception after first attempt.

Reproduction Steps

Difficult to reproduce on demand.

Environment

Azure AppService .Net Version: 6.0.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jsquirecommented, Mar 18, 2022

Thank you for the additional context, @pjonusas. Unfortunately, the behavior that you’re seeing is expected in this scenario. Due to the way that transactions work with Service Bus, retries cannot be performed when there is an active ambient transaction. Looking over the docs, it seems that we did a poor job of calling this out. I’ve opened #27637 and #90071 to track getting retry guidance added.

I’m going to mark this as addressed, but please feel free to unresolve if you’d like to continue the discussion.

0reactions
msftbot[bot]commented, Mar 26, 2022

Hi @pjonusas, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Service Bus Retry Options Not Working (v5.2.0)
When reading or publishing a message fails due to an error that is deemed transient, these settings are applied to client retries. This...
Read more >
Troubleshooting guide for Azure Service Bus
This article provides troubleshooting tips and recommendations for a few issues that you may see when using Azure Service Bus.
Read more >
Receiving messages from Azure Service Bus in C# - Ciaran O ...
A quick demo showing how to receive messages from Service Bus using C# and .NET.
Read more >
Handling Azure Service Bus errors with .NET
Senders and Receivers handle errors on Azure Service Bus differently. We'll see how to catch them, what they mean and how to fix...
Read more >
'Azure.Messaging.ServiceBus.ServiceBusExceptio' when ...
Hi We are getting stuck in what seems like an endless message loop, when trying to publish event using Azure Service Bus.
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