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

Retry handler returns http status code 415 for POST requests #435

Closed
peombwa opened this issue Apr 12, 2019 · 8 comments · Fixed by #451
Closed

Retry handler returns http status code 415 for POST requests #435

peombwa opened this issue Apr 12, 2019 · 8 comments · Fixed by #451
Assignees
Labels

Comments

@peombwa
Copy link
Member

peombwa commented Apr 12, 2019

Expected behavior

Retry handler should return http status 202 for POST requests after retrying 429 responses.

Actual behavior

Retry handler returns http status 415 - missing or empty content type header - when retrying 429 responses.

Steps to reproduce the behavior

Send multiple post requests (~30) to graph service.

@Misiu
Copy link

Misiu commented Apr 16, 2019

@pwombwa I have the exact same behavior when trying to send multiple emails.
Here is my test code:

var mails = new List<Message>();

for (int j = 0; j < 50; j++)
{
    var email = new Message
    {
        Body = new ItemBody
        {
            Content = "TEst mail",
            ContentType = BodyType.Html,
        },
        Subject = "Test",
        ToRecipients = recipientList,
        Attachments = att
    };
    mails.Add(email);
}

var tasks = new List<Task>();
foreach (var message in mails)
{
    tasks.Add(SendMail(graphClient, message));
}

await Task.WhenAll(tasks.ToArray());

private async Task SendMail(IGraphServiceClient graphClient, Message message)
{
    await graphClient.Users["test@example.onmicrosoft.com"].SendMail(message, true).Request().WithMaxRetry(10).PostAsync();
}

Im Fiddler I get 202, then 429 and finally 415:
graph_exception2

I'm adding WithMaxRetry to each request, shouldn't this handle throttling and retrying?

@peombwa
Copy link
Member Author

peombwa commented Apr 17, 2019

@Misiu, our retry handler ignores the Content-Type header when retrying 429 responses. This has been fixed and it will be available in v1.15.0.

@Misiu
Copy link

Misiu commented Apr 18, 2019

@pwombwa when is 1.15.0 expected? I don't see any milestone with that number.
1.14.0 was released in the middle of March.

@peombwa
Copy link
Member Author

peombwa commented Apr 19, 2019

@Misiu We've released Microsoft.Graph.Core v1.15.0-preview.1 which fixes this issue. Try it out and let us know if it addresses your scenario before we close this issue,

@Misiu
Copy link

Misiu commented Apr 23, 2019

@pwombwa I've tried the new version, but when I tried sending 40 emails at once I got 202 for some requests, 429 for some and 408 for some:
graph_408

@darrelmiller
Copy link
Contributor

@Misiu Thanks for the detailed feedback, we have a theory on why this is happening and are working on a fix.

@peombwa
Copy link
Member Author

peombwa commented Apr 27, 2019

@Misiu We've fixed this issue as part of Microsoft.Graph.Core 1.15.0-preview.2 and all requests should now succeed with status 202. Give it a try and let us know if it addresses your scenario.

@peombwa peombwa reopened this Apr 27, 2019
@peombwa peombwa closed this as completed May 3, 2019
@Misiu
Copy link

Misiu commented May 7, 2019

@peombwa sorry for the late reply. I've tested the latest release and in my case, it works fine. Thank You 😉

@ghost ghost locked as resolved and limited conversation to collaborators Feb 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants