-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[release/6.0] Enforce HttpClient limits on GetFromJsonAsync #80552
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsBackport of a minimized change of #79386 to release/6.0 Customer ImpactTODO TestingTODO RiskTODO
|
Last day to merge backports for the February Release is tomorrow. Please fill out the template, make sure to mention the customer impact. Add the |
Talked to @MihaZupan. This will go in next month. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Hey @ViktorHofer what should we do about this failure?:
|
That's happening because of dotnet/sdk@4c7675d. Apparently serviced SDKs now also warn about a TFM that moves out of support, even when that's long after the stable SDK itself shipped originally. We still produce net5.0 assets in our release/6.0 branch and we don't want to stop doing that. So we need an escape switch => You can suppress that error by setting
|
Approved by Tactics via email by @SteveMCarroll on 2/9. |
Backport of a minimized change of #79386 to release/6.0
Customer Impact
HttpClient has two properties users can tweak to limit the amount of time and resources spent on a given request (
Timeout
andMaxResponseContentBufferSize
).GetFromJsonAsync
is inconsistent in the enforcement of these limits compared to other helpers (GetStringAsync
,GetByteArrayAsync
, andDeleteFromJsonAsync
).There are three main ways to get the response content from HttpClient:
ResponseHeadersRead
, asking the client not to buffer the response content as part of theSendAsync
callThis PR changes the behavior of the
client.GetFromJsonAsync
helper to match that ofGetStringAsync
and friends (case 1).This allows us to present consistent
HttpClient
behavior across the board.Testing
I added targeted CI tests that confirm limits are consistently enforced.
Risk
The enforcement of limits means that some requests that would previously succeed may now fail (either time out or exceed the size limit). It is unlikely that anyone is knowingly relying on this behavior given the inconsistencies mentioned above.
The default limits are also very large (100 seconds and 2 GB of content), so for a request to hit them, the user has most likely lowered them manually, indicating the intent that they do want them to be enforced. It also means that if they do run into issues, they can tweak the existing settings directly.
The change can also result in slightly higher memory consumption as we're buffering the whole body before we start the deserialization process. We do not expect this to be meaningfully impactful.