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] Unable to catch Exception due to indefinite retry

See original GitHub issue

Describe the bug I’m unable to catch the exception because it seems to retry indefinitely.

Exception or Stack Trace None.

Code Snippet

// https://docs.microsoft.com/en-us/dotnet/azure/dotnet-sdk-azure-concepts?view=azure-dotnet#logs-and-tracing
ServiceClientTracing.AddTracingInterceptor(new ConsoleTracer()); 
ServiceClientTracing.IsEnabled = true;

var azure = Azure
		.Configure()
		.WithDelegatingHandler(new HttpLoggingDelegatingHandler())
		.WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
		.Authenticate(credentials)
		.WithDefaultSubscription();

var webApp = azure.WebApps.GetByResourceGroup("rgName", "webAppName");

try
	{
		webApp.Update()
		.DefineHostnameBinding()
			.WithThirdPartyDomain("foobar.com")
			.WithSubDomain("@")
			.WithDnsRecordType(CustomHostNameDnsRecordType.A)
			.Attach()
		.Apply();
	}
	catch (RestException exception){
		// never gets here.
	}

Expected behavior A raised exception of any kind can be caught by client code.

Setup (please complete the following information):

  • OS: Windows
  • IDE : LinqPad
  • Version of the Library used: 1.22

Additional context Even when i add a RetryPolicy

.WithRetryPolicy(new RetryPolicy(new HttpStatusCodeErrorDetectionStrategy(), new FixedIntervalRetryStrategy(0)))

or try to remove the default one

.WithRetryPolicy(null)

It seems to be ignored.

The DefaultErrorResponseException is logged to the console

“Microsoft.Azure.Management.AppService.Fluent.Models.DefaultErrorResponseException: Operation returned an invalid status code ‘BadRequest’”

over and over again with unique invocation ids.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ x] Bug Description Added
  • [x ] Repro Steps Added
  • [x ] Setup information Added

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kwill-MSFTcommented, Jul 15, 2019

@kurtzeborn, this is not an App Services issue. This seems to be a general problem with the Fluent SDK. The following code also reproduces the same issue. The underlying API returns a 400 with PrincipalNotFound, but the SDK continues retrying indefinitely.

    class Program
    {
        static async Task Main(string[] args)
        {
            AzureServiceTokenProvider azureServiceTokenProvider = new AzureServiceTokenProvider();
            string accessToken = azureServiceTokenProvider.GetAccessTokenAsync("https://management.azure.com").Result;
            AzureCredentials credentials = new AzureCredentials(new TokenCredentials(accessToken), new TokenCredentials(accessToken), string.Empty, AzureEnvironment.AzureGlobalCloud);

            Console.WriteLine("Setting role assignment");
            var task = Azure.Configure().Authenticate(credentials).
                RoleAssignments.
                Define(System.Guid.NewGuid().ToString()).
                ForObjectId("2c3d72a7-3385-48ef-bd42-f606fba81abc").  // This should be an invalid objectid (an oid not in the tenant)
                WithBuiltInRole(BuiltInRole.Contributor).
                WithScope("/subscriptions/1237f4d2-3dce-4b96-ad95-677f764e7123").  // Ensure this is a valid subscriptionId
                CreateAsync();
            task.Wait();
            Console.WriteLine("Done with role assignment");
        }
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Confusing behavior when using retry() and wrapping an ...
If the exception comes from downstream through the upstream's emit() then there it shouldn't retry as the downstream has failed already.
Read more >
[🐛 Bug]: RetryRequest -> unlimited retries? · Issue #10437
And it seems selenium tries to execute that request indefinitely. ( RetryRequest ... RetryRequest Failure due to server error #1. Retrying.
Read more >
How to retry just once on exception in python
The answer almost works, but if you reach the raise, you get "RuntimeError: No active exception to reraise" (maybe this used to work...
Read more >
Java get request unable to retry indefinitely
I'm trying to indefinitely retry a get request using a custom RetryStrategy like this: Flux.just(1, 2, 3) .flatMap(i -> bucket.reactive().
Read more >
Correct way to retry IS Trigger Service - webMethods
Your flow service should catch a transient error and re-throw it as a run-time exception, by invoking pub.flow:throwExceptionForRetry.
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