octokit / octokit.net

A GitHub API client library for .NET
https://octokitnet.readthedocs.io/en/latest/
MIT License
2.7k stars 1.08k forks source link

[BUG]: After about 5 hours of running, octokit starts returning 400 Request Header Or Cookie Too Large #2980

Open adegeo opened 2 weeks ago

adegeo commented 2 weeks ago

What happened?

I'm not sure what to do about this. My azure function starts returning this error after about 5 hours of running. I get this when calling CreateInstallationToken on the github client object. If I restart the app, everything starts working fine. I can reproduce this locally, it just takes 5 hours of running before it shows up.

Versions

Octokit.NET 13.0.1

Relevant log output

No response

Code of Conduct

nickfloyd commented 2 weeks ago

Hey @adegeo thanks for reaching out and apologies for the trouble.

This feels like you might be hitting a server side limitation and should probably consider implementing rate limit handling and incremental back offs. It also feels like the azure might be recursively storing and/or resending header data but without actually seeing the code it would be hard to say.

Would you happen to be able to share the source of the function or describe what it does and how it uses this SDK? If it's an internal repo feel free to reach out to me on teams.

And an aside we've been working on generative SDKs and we've implemented some fairly elegant rate limiting / automatic retry logic in those SDKs if you'd be interested in trying that as an alternative to our much older implementation.

I look forward to hearing from you.

adegeo commented 1 week ago

@nickfloyd Hi! Thanks for getting back to me. I pinged you on Teams.

adegeo commented 1 week ago

The Azure Function's code is on GitHub here: docs-tools/RepoMan at adegeo-repoman2 · dotnet/docs-tools (github.com)

The token request happens here: docs-tools/RepoMan/GitHubAccess.cs at adegeo-repoman2 · dotnet/docs-tools and then with GitHubJwt NuGet package.

nickfloyd commented 1 day ago

Hey @adegeo I have not been able to make any progress on this. We're quite a bit short handed this week - hopefully I'll be able to give it the time it needs tomorrow.

adegeo commented 1 day ago

OK Thanks! It occurred to me that I could setup a runbook in azure that just reboots my function every few hours to at least keep it running normally.

Should I be looking at using that other SDK you linked to?

nickfloyd commented 1 day ago

OK Thanks! It occurred to me that I could setup a runbook in azure that just reboots my function every few hours to at least keep it running normally.

That would be ideal. We just had a few priorities reshuffle on us and I'm not going to be able to get to this in the near term - apologies for the side track.

Should I be looking at using that other SDK you linked to?

You should definitely give it a try if you have time - it has much more updated patterns and API coverage.