Gmail API - Rate Limit Exceeded [429], Backend Error [500]
We have an application that uses the Gmail API to access emails in Gmail.
Randomly we got the following error message
Google.Apis.Requests.RequestError Rate Limit Exceeded [429] Errors [
Message[Rate Limit Exceeded] Location[ - ] Reason[rateLimitExceeded]
Domain[usageLimits] ]
Which we then retry in our code on error event and got
Google.Apis.Requests.RequestError Backend Error [500] Errors [
Message[Backend Error] Location[ - ] Reason[backendError]
Domain[global] ]
which we then retry in our code on error event (we try 3 times) and it worked as expected.
There is some issue with the Gmail API backend here. we are making < 1000 Gmail API calls per day and nothing concurrent so I can't see that we have breached any limits.
Anybody else encountering this strange behaviour?
Here is the code that is being called
UsersResource.MessagesResource.GetRequest gr = gs.Users.Messages.Get(emailAccount, msgId);
{
gr.Format = UsersResource.MessagesResource.GetRequest.FormatEnum.Raw;
Message m = new Message();
try
{
m = gr.Execute();
}
}
c# google-api
add a comment |
We have an application that uses the Gmail API to access emails in Gmail.
Randomly we got the following error message
Google.Apis.Requests.RequestError Rate Limit Exceeded [429] Errors [
Message[Rate Limit Exceeded] Location[ - ] Reason[rateLimitExceeded]
Domain[usageLimits] ]
Which we then retry in our code on error event and got
Google.Apis.Requests.RequestError Backend Error [500] Errors [
Message[Backend Error] Location[ - ] Reason[backendError]
Domain[global] ]
which we then retry in our code on error event (we try 3 times) and it worked as expected.
There is some issue with the Gmail API backend here. we are making < 1000 Gmail API calls per day and nothing concurrent so I can't see that we have breached any limits.
Anybody else encountering this strange behaviour?
Here is the code that is being called
UsersResource.MessagesResource.GetRequest gr = gs.Users.Messages.Get(emailAccount, msgId);
{
gr.Format = UsersResource.MessagesResource.GetRequest.FormatEnum.Raw;
Message m = new Message();
try
{
m = gr.Execute();
}
}
c# google-api
This seems like a discussion question, and thus isn't appropriate for Stack Overflow.
– Greg
Sep 18 '14 at 3:24
What types of requests are you making? Using batched calls?
– Eric D
Sep 18 '14 at 17:37
Hi Eric, was just a simple Message get - nothing batched. I'm thinking is a glitch in the google backend with misleading error message.
– PNC
Sep 19 '14 at 3:35
We got the same random Exceptions. I know this is an old post, but did someone find any workaround?
– F3L1X79
Mar 22 '16 at 10:43
1
Hi @F3L1X79 - no workaround - still occurs, retry is the only solution that we have found. Error is very rare though now.
– PNC
Mar 23 '16 at 18:05
add a comment |
We have an application that uses the Gmail API to access emails in Gmail.
Randomly we got the following error message
Google.Apis.Requests.RequestError Rate Limit Exceeded [429] Errors [
Message[Rate Limit Exceeded] Location[ - ] Reason[rateLimitExceeded]
Domain[usageLimits] ]
Which we then retry in our code on error event and got
Google.Apis.Requests.RequestError Backend Error [500] Errors [
Message[Backend Error] Location[ - ] Reason[backendError]
Domain[global] ]
which we then retry in our code on error event (we try 3 times) and it worked as expected.
There is some issue with the Gmail API backend here. we are making < 1000 Gmail API calls per day and nothing concurrent so I can't see that we have breached any limits.
Anybody else encountering this strange behaviour?
Here is the code that is being called
UsersResource.MessagesResource.GetRequest gr = gs.Users.Messages.Get(emailAccount, msgId);
{
gr.Format = UsersResource.MessagesResource.GetRequest.FormatEnum.Raw;
Message m = new Message();
try
{
m = gr.Execute();
}
}
c# google-api
We have an application that uses the Gmail API to access emails in Gmail.
Randomly we got the following error message
Google.Apis.Requests.RequestError Rate Limit Exceeded [429] Errors [
Message[Rate Limit Exceeded] Location[ - ] Reason[rateLimitExceeded]
Domain[usageLimits] ]
Which we then retry in our code on error event and got
Google.Apis.Requests.RequestError Backend Error [500] Errors [
Message[Backend Error] Location[ - ] Reason[backendError]
Domain[global] ]
which we then retry in our code on error event (we try 3 times) and it worked as expected.
There is some issue with the Gmail API backend here. we are making < 1000 Gmail API calls per day and nothing concurrent so I can't see that we have breached any limits.
Anybody else encountering this strange behaviour?
Here is the code that is being called
UsersResource.MessagesResource.GetRequest gr = gs.Users.Messages.Get(emailAccount, msgId);
{
gr.Format = UsersResource.MessagesResource.GetRequest.FormatEnum.Raw;
Message m = new Message();
try
{
m = gr.Execute();
}
}
c# google-api
c# google-api
edited Mar 27 '17 at 6:40
DaImTo
42.5k1056233
42.5k1056233
asked Sep 18 '14 at 2:46
PNC
1,1891030
1,1891030
This seems like a discussion question, and thus isn't appropriate for Stack Overflow.
– Greg
Sep 18 '14 at 3:24
What types of requests are you making? Using batched calls?
– Eric D
Sep 18 '14 at 17:37
Hi Eric, was just a simple Message get - nothing batched. I'm thinking is a glitch in the google backend with misleading error message.
– PNC
Sep 19 '14 at 3:35
We got the same random Exceptions. I know this is an old post, but did someone find any workaround?
– F3L1X79
Mar 22 '16 at 10:43
1
Hi @F3L1X79 - no workaround - still occurs, retry is the only solution that we have found. Error is very rare though now.
– PNC
Mar 23 '16 at 18:05
add a comment |
This seems like a discussion question, and thus isn't appropriate for Stack Overflow.
– Greg
Sep 18 '14 at 3:24
What types of requests are you making? Using batched calls?
– Eric D
Sep 18 '14 at 17:37
Hi Eric, was just a simple Message get - nothing batched. I'm thinking is a glitch in the google backend with misleading error message.
– PNC
Sep 19 '14 at 3:35
We got the same random Exceptions. I know this is an old post, but did someone find any workaround?
– F3L1X79
Mar 22 '16 at 10:43
1
Hi @F3L1X79 - no workaround - still occurs, retry is the only solution that we have found. Error is very rare though now.
– PNC
Mar 23 '16 at 18:05
This seems like a discussion question, and thus isn't appropriate for Stack Overflow.
– Greg
Sep 18 '14 at 3:24
This seems like a discussion question, and thus isn't appropriate for Stack Overflow.
– Greg
Sep 18 '14 at 3:24
What types of requests are you making? Using batched calls?
– Eric D
Sep 18 '14 at 17:37
What types of requests are you making? Using batched calls?
– Eric D
Sep 18 '14 at 17:37
Hi Eric, was just a simple Message get - nothing batched. I'm thinking is a glitch in the google backend with misleading error message.
– PNC
Sep 19 '14 at 3:35
Hi Eric, was just a simple Message get - nothing batched. I'm thinking is a glitch in the google backend with misleading error message.
– PNC
Sep 19 '14 at 3:35
We got the same random Exceptions. I know this is an old post, but did someone find any workaround?
– F3L1X79
Mar 22 '16 at 10:43
We got the same random Exceptions. I know this is an old post, but did someone find any workaround?
– F3L1X79
Mar 22 '16 at 10:43
1
1
Hi @F3L1X79 - no workaround - still occurs, retry is the only solution that we have found. Error is very rare though now.
– PNC
Mar 23 '16 at 18:05
Hi @F3L1X79 - no workaround - still occurs, retry is the only solution that we have found. Error is very rare though now.
– PNC
Mar 23 '16 at 18:05
add a comment |
1 Answer
1
active
oldest
votes
The Gmail API has the same daily usage limit that applies to all requests made from your application, as well as per-user rate limits.
- Daily Usage 1,000,000,000 quota units per day Per User Rate
Limit - 250 quota units per user per second, moving average (allows
short bursts)
Exceeding a rate limit (going to fast) will cause an HTTP 403 or HTTP 429 Too Many Requests response and your app should respond by retrying with exponential backoff.
The 500 errors are server hiccups the server took to long to respond so it timed out your request. The solution for this is the same as the solution for the above error you should implement exponential backoff and try again.
Exponential backoff is a standard error handling strategy for network
applications in which the client periodically retries a failed request
over an increasing amount of time. If a high volume of requests or
heavy network traffic causes the server to return errors, exponential
backoff may be a good strategy for handling those errors. Conversely,
it is not a relevant strategy for dealing with errors unrelated to
rate-limiting, network volume or response times, such as invalid
authorization credentials or file not found errors.
Used properly, exponential backoff increases the efficiency of
bandwidth usage, reduces the number of requests required to get a
successful response, and maximizes the throughput of requests in
concurrent environments.
The flow for implementing simple exponential backoff is as follows.
- Make a request to the API
- Receive an error response that has a retry-able error code
- Wait 1s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 2s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 4s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 8s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 16s + random_number_milliseconds seconds
- Retry request
- If you still get an error, stop and log the error.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25903384%2fgmail-api-rate-limit-exceeded-429-backend-error-500%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The Gmail API has the same daily usage limit that applies to all requests made from your application, as well as per-user rate limits.
- Daily Usage 1,000,000,000 quota units per day Per User Rate
Limit - 250 quota units per user per second, moving average (allows
short bursts)
Exceeding a rate limit (going to fast) will cause an HTTP 403 or HTTP 429 Too Many Requests response and your app should respond by retrying with exponential backoff.
The 500 errors are server hiccups the server took to long to respond so it timed out your request. The solution for this is the same as the solution for the above error you should implement exponential backoff and try again.
Exponential backoff is a standard error handling strategy for network
applications in which the client periodically retries a failed request
over an increasing amount of time. If a high volume of requests or
heavy network traffic causes the server to return errors, exponential
backoff may be a good strategy for handling those errors. Conversely,
it is not a relevant strategy for dealing with errors unrelated to
rate-limiting, network volume or response times, such as invalid
authorization credentials or file not found errors.
Used properly, exponential backoff increases the efficiency of
bandwidth usage, reduces the number of requests required to get a
successful response, and maximizes the throughput of requests in
concurrent environments.
The flow for implementing simple exponential backoff is as follows.
- Make a request to the API
- Receive an error response that has a retry-able error code
- Wait 1s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 2s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 4s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 8s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 16s + random_number_milliseconds seconds
- Retry request
- If you still get an error, stop and log the error.
add a comment |
The Gmail API has the same daily usage limit that applies to all requests made from your application, as well as per-user rate limits.
- Daily Usage 1,000,000,000 quota units per day Per User Rate
Limit - 250 quota units per user per second, moving average (allows
short bursts)
Exceeding a rate limit (going to fast) will cause an HTTP 403 or HTTP 429 Too Many Requests response and your app should respond by retrying with exponential backoff.
The 500 errors are server hiccups the server took to long to respond so it timed out your request. The solution for this is the same as the solution for the above error you should implement exponential backoff and try again.
Exponential backoff is a standard error handling strategy for network
applications in which the client periodically retries a failed request
over an increasing amount of time. If a high volume of requests or
heavy network traffic causes the server to return errors, exponential
backoff may be a good strategy for handling those errors. Conversely,
it is not a relevant strategy for dealing with errors unrelated to
rate-limiting, network volume or response times, such as invalid
authorization credentials or file not found errors.
Used properly, exponential backoff increases the efficiency of
bandwidth usage, reduces the number of requests required to get a
successful response, and maximizes the throughput of requests in
concurrent environments.
The flow for implementing simple exponential backoff is as follows.
- Make a request to the API
- Receive an error response that has a retry-able error code
- Wait 1s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 2s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 4s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 8s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 16s + random_number_milliseconds seconds
- Retry request
- If you still get an error, stop and log the error.
add a comment |
The Gmail API has the same daily usage limit that applies to all requests made from your application, as well as per-user rate limits.
- Daily Usage 1,000,000,000 quota units per day Per User Rate
Limit - 250 quota units per user per second, moving average (allows
short bursts)
Exceeding a rate limit (going to fast) will cause an HTTP 403 or HTTP 429 Too Many Requests response and your app should respond by retrying with exponential backoff.
The 500 errors are server hiccups the server took to long to respond so it timed out your request. The solution for this is the same as the solution for the above error you should implement exponential backoff and try again.
Exponential backoff is a standard error handling strategy for network
applications in which the client periodically retries a failed request
over an increasing amount of time. If a high volume of requests or
heavy network traffic causes the server to return errors, exponential
backoff may be a good strategy for handling those errors. Conversely,
it is not a relevant strategy for dealing with errors unrelated to
rate-limiting, network volume or response times, such as invalid
authorization credentials or file not found errors.
Used properly, exponential backoff increases the efficiency of
bandwidth usage, reduces the number of requests required to get a
successful response, and maximizes the throughput of requests in
concurrent environments.
The flow for implementing simple exponential backoff is as follows.
- Make a request to the API
- Receive an error response that has a retry-able error code
- Wait 1s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 2s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 4s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 8s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 16s + random_number_milliseconds seconds
- Retry request
- If you still get an error, stop and log the error.
The Gmail API has the same daily usage limit that applies to all requests made from your application, as well as per-user rate limits.
- Daily Usage 1,000,000,000 quota units per day Per User Rate
Limit - 250 quota units per user per second, moving average (allows
short bursts)
Exceeding a rate limit (going to fast) will cause an HTTP 403 or HTTP 429 Too Many Requests response and your app should respond by retrying with exponential backoff.
The 500 errors are server hiccups the server took to long to respond so it timed out your request. The solution for this is the same as the solution for the above error you should implement exponential backoff and try again.
Exponential backoff is a standard error handling strategy for network
applications in which the client periodically retries a failed request
over an increasing amount of time. If a high volume of requests or
heavy network traffic causes the server to return errors, exponential
backoff may be a good strategy for handling those errors. Conversely,
it is not a relevant strategy for dealing with errors unrelated to
rate-limiting, network volume or response times, such as invalid
authorization credentials or file not found errors.
Used properly, exponential backoff increases the efficiency of
bandwidth usage, reduces the number of requests required to get a
successful response, and maximizes the throughput of requests in
concurrent environments.
The flow for implementing simple exponential backoff is as follows.
- Make a request to the API
- Receive an error response that has a retry-able error code
- Wait 1s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 2s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 4s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 8s + random_number_milliseconds seconds
- Retry request
- Receive an error response that has a retry-able error code
- Wait 16s + random_number_milliseconds seconds
- Retry request
- If you still get an error, stop and log the error.
answered Mar 27 '17 at 6:38
DaImTo
42.5k1056233
42.5k1056233
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25903384%2fgmail-api-rate-limit-exceeded-429-backend-error-500%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This seems like a discussion question, and thus isn't appropriate for Stack Overflow.
– Greg
Sep 18 '14 at 3:24
What types of requests are you making? Using batched calls?
– Eric D
Sep 18 '14 at 17:37
Hi Eric, was just a simple Message get - nothing batched. I'm thinking is a glitch in the google backend with misleading error message.
– PNC
Sep 19 '14 at 3:35
We got the same random Exceptions. I know this is an old post, but did someone find any workaround?
– F3L1X79
Mar 22 '16 at 10:43
1
Hi @F3L1X79 - no workaround - still occurs, retry is the only solution that we have found. Error is very rare though now.
– PNC
Mar 23 '16 at 18:05