Repository navigation
Only rate limit ACR referrer lookup requests - #2143
Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
Current code has a problem where unbounded concurrency sends too many oauth requests to the registry up-front during image copying, causing more 429 errors. The default HTTP client has retries enabled, but oauth requests are POST requests, so they aren't retried. I will have a fix for this pushed shortly. |
| CancellationToken cancellationToken) | ||
| { | ||
| Interlocked.Increment(ref _requestCount); | ||
| return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)); |
| catch (Exception exception) when (exception is ArgumentException or SecurityTokenMalformedException) | ||
| { | ||
| } |
|
I tested this internally with a publish run of the dotnet-docker pipeline: build#3002401 Here are some metrics from that run:
Requests/responses by endpoint:
The high number of 401 responses is normal. ORAS only tries to get a token for the registry if it gets a 401 first. 429 responses for oauth requests still happen due to unbounded parallelism, but now they are correctly handled by the Azure SDK. If we see further issues or failures, then we can revisit bounded parallelism with higher limits. The high number of oauth token requests is not expected, so I'm investigating. |
This PR fixes #2141. The issue text contains the detailed explanation of why these changes are necessary, but summarizing here: