Skip to content

[BUG] Incorrect Retry Handling for Document Intelligence - 429 Status regardless of Retry options #50904

Open
@kikaragyozov

Description

@kikaragyozov

Library name and version

Azure.AI.DocumentIntelligence.1.0.0

Describe the bug

When running under the free plan for Document Intelligence, regardless of what settings you use for your Retry Policy - be it Exponential, be it Fixed, you'll always get hit with a 429 too many requests when for example you invoke the following method of the SDK:

Operation<Azure.AI.DocumentIntelligence.AnalyzeResult> classification = await _client.ClassifyDocumentAsync(WaitUntil.Completed, new ClassifyDocumentOptions(classifier.AzureId, data)
                {
                    Pages = "1",
                    Split = SplitMode.None
                }, cancellationToken);

Because the free plan has a Get request limit of 1 second, either the SDK has a faulty logic in where it does the first request "fast" and then immediately does a retry, before applying any of the settings the user has configured for a subsequent retry, or the SDK in no way, shape, or form, uses the RetryPolicy a user has defined for Polling and instead, does something else.

The behavior is only observed when the option WaitUntil.Completed is specified. You always get hit with a 429 too many requests, regardless of what you set up via ConfigureOptions like so:

.ConfigureOptions(options =>
{
    options.Retry.Mode = RetryMode.Fixed;
    options.Retry.MaxRetries = 157;
    options.Retry.Delay = TimeSpan.FromSeconds(15);
    options.Retry.MaxDelay = TimeSpan.FromSeconds(30);
});

With the given options above, we can still observe polling from Azure's side. We also tried using Exponential with similar settings, to no avail.

Expected behavior

I expect that when I correctly know my limits imposed by Azure, that when I configure the Retry Policy to conform with them, and additionally, limit any outbound requests with an application-wide semaphore, to never be hit with a 429 too many requests, ever.

This is not the case, and it fails immediately with that single method.

What's going on?

Actual behavior

Upon invoking the method, you get hit with a 429 too many requests when running on a Free Plan.

Reproduction Steps

Call the method on a free plan environment and you'll see a 429 in the logs.

Environment

No response

Metadata

Metadata

Assignees

Labels

ClientThis issue is related to a non-management packageCognitive - Form Recognizercustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-author-feedbackWorkflow: More information is needed from author to address the issue.no-recent-activityThere has been no recent activity on this issue.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions