Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occasional 429 errors (Too Many Requests) in Drive activity polls #2161

Open
jpd236 opened this issue May 25, 2024 · 0 comments
Open

Occasional 429 errors (Too Many Requests) in Drive activity polls #2161

jpd236 opened this issue May 25, 2024 · 0 comments

Comments

@jpd236
Copy link
Contributor

jpd236 commented May 25, 2024

My server logs show occasional instances of 429s in the Drive activity queries:

code: 429,
  errors: [
    {
      message: 'Resource has been exhausted (e.g. check quota).',
      domain: 'global',
      reason: 'rateLimitExceeded'
    }
  ]
}

The overall error rate looks quite low in the console (0.02%), though it is a bit noisy. From what I can tell we're doing between 10-15 queries per minute, and the limit per minute per user is 100.

It seems like there might be some retries here already; I wonder if we just need to back off a bit more in this case.

jpd236 added a commit to jpd236/jolly-roger that referenced this issue Jun 28, 2024
The default retry policy (documented
[here](https://github.com/googleapis/gaxios/#request-options)) does not
retry POST requests. But most Google API calls use POST requests under
the covers, including read-only APIs like [Drive
Activity](https://developers.google.com/drive/activity/v2/reference/rest/v2/activity/query).
So we can also ask to retry POST requests.

We retain other aspects of the default policy, such as the number of
attempts (3) and the HTTP status codes to retry (100-109, 408, 429,
5xx). If a request succeeds on a retry, the failure is kept silent and
does not pollute the logs.

The main risk is that a POST method might mutate some state despite
returning a failure, and that inline retries might handle that
incorrectly or otherwise make things worse than retrying the full flow
from the ground up. This doesn't seem likely to be an issue with the
current set of API calls, but if desired, we could narrow this change to
specific known-safe requests.

See deathandmayhem#2160
See deathandmayhem#2161
jpd236 added a commit to jpd236/jolly-roger that referenced this issue Jun 28, 2024
The default retry policy (documented
[here](https://github.com/googleapis/gaxios/#request-options)) does not
retry POST requests. But most Google API calls use POST requests under
the covers, including read-only APIs like [Drive
Activity](https://developers.google.com/drive/activity/v2/reference/rest/v2/activity/query).
So we can also ask to retry POST requests.

We retain other aspects of the default policy, such as the number of
attempts (3) and the HTTP status codes to retry (100-109, 408, 429,
5xx). If a request succeeds on a retry, the failure is kept silent and
does not pollute the logs.

The main risk is that a POST method might mutate some state despite
returning a failure, and that inline retries might handle that
incorrectly or otherwise make things worse than retrying the full flow
from the ground up. This doesn't seem likely to be an issue with the
current set of API calls, but if desired, we could narrow this change to
specific known-safe requests.

See deathandmayhem#2160
See deathandmayhem#2161
jpd236 added a commit to jpd236/jolly-roger that referenced this issue Jun 28, 2024
The default retry policy (documented
[here](https://github.com/googleapis/gaxios/#request-options)) does not
retry POST requests. But most Google API calls use POST requests under
the covers, including read-only APIs like [Drive
Activity](https://developers.google.com/drive/activity/v2/reference/rest/v2/activity/query).
So we can also ask to retry POST requests.

We retain other aspects of the default policy, such as the number of
attempts (3) and the HTTP status codes to retry (100-109, 408, 429,
5xx). If a request succeeds on a retry, the failure is kept silent and
does not pollute the logs.

The main risk is that a POST method might mutate some state despite
returning a failure, and that inline retries might handle that
incorrectly or otherwise make things worse than retrying the full flow
from the ground up. This doesn't seem likely to be an issue with the
current set of API calls, but if desired, we could narrow this change to
specific known-safe requests.

See deathandmayhem#2160
See deathandmayhem#2161
jpd236 added a commit to jpd236/jolly-roger that referenced this issue Jun 28, 2024
The default retry policy (documented
[here](https://github.com/googleapis/gaxios/#request-options)) does not
retry POST requests. But most Google API calls use POST requests under
the covers, including read-only APIs like [Drive
Activity](https://developers.google.com/drive/activity/v2/reference/rest/v2/activity/query).
So we can also ask to retry POST requests.

We retain other aspects of the default policy, such as the number of
attempts (3) and the HTTP status codes to retry (100-109, 408, 429,
5xx). If a request succeeds on a retry, the failure is kept silent and
does not pollute the logs.

The main risk is that a POST method might mutate some state despite
returning a failure, and that inline retries might handle that
incorrectly or otherwise make things worse than retrying the full flow
from the ground up. This doesn't seem likely to be an issue with the
current set of API calls, but if desired, we could narrow this change to
specific known-safe requests.

See deathandmayhem#2160
See deathandmayhem#2161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant