Skip to content

Conversation

@Tratcher
Copy link
Member

@Tratcher Tratcher commented Sep 3, 2021

Fixes #28384
6.0 rc2 candidate: resource leak / hang

  • The HttpResponseMessage needs to be buffered, drained, or disposed to free up the connection for the next request.
  • Polly is a generic policy library, it's not aware of HttpRequest/ResponseMessage lifetimes or the need to dispose them on retry. Polly.Extensions.Http is aware of HttpRequest/ResponseMessage but doesn't participate in the retry execution, only the decision on if a retry is recommended.

Fix: Add a reference from the request to the response so that if the request is retried, it can dispose the prior response.

@Tratcher Tratcher added area-runtime feature-httpclientfactory Includes: HttpClientFactory (some bugs also in Extensions repo) labels Sep 3, 2021
@Tratcher Tratcher added this to the 7.0-preview1 milestone Sep 3, 2021
@Tratcher Tratcher requested a review from rynowak September 3, 2021 21:31
@Tratcher Tratcher self-assigned this Sep 3, 2021
@davidfowl davidfowl enabled auto-merge (squash) September 8, 2021 15:52
@davidfowl davidfowl disabled auto-merge September 8, 2021 15:52
@Tratcher Tratcher merged commit 8d5212d into dotnet:main Sep 9, 2021
@Tratcher Tratcher deleted the tratcher/clientfactory/dispose branch September 9, 2021 00:21
@Tratcher
Copy link
Member Author

Tratcher commented Sep 9, 2021

/backport to release/6.0

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2021

@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-httpclientfactory Includes: HttpClientFactory (some bugs also in Extensions repo)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microsoft.Extensions.Http.Polly: Deadlock when retrying a "503 - Service unavailable"

3 participants