Azure/azure-cosmos-js

Why retry for error 429

zzcodework opened this issue · 2 comments

We got throttled but from our own logs we didn't reach the RU limit, then we figured out that it was the automatic retry internally caused the gaps between number of logs shown in our logs and cosmos metrics in azure portal.

Questions:

  1. Why return error code 503 instead of 429 after maximum retries?
  2. Why even retry if it's already 429?

@zzcodework I'm not fully understanding the issue. Are you seeing 503's after max retry attempts are reached? If we are doing that somewhere it is a bug. I took a quick glance at the code and we should be bubbling up the 429 error https://github.com/Azure/azure-cosmos-js/blob/master/src/retry/retryUtility.ts#L100-L106

Closing as we resolved with @zzcodework off Github. For any future people who find this issue:

  1. The SDK will never throw a synthetic 503 error. Any 503 is bubbled from the backend. The backend error message may contain a reference to 429 if it did some kind of internal retry
  2. It is possible, but not recommend, to turn off retry on 429 for the SDK. Set maxRetryAttemptCount = 0 in the cosmos client config option