Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Port to RC2: Fix CurlResponseStream.Dispose to cancel the request #7964

Merged
merged 1 commit into from
Apr 21, 2016

Conversation

stephentoub
Copy link
Member

We weren't canceling the request when prematurely Dispose'ing the response stream. Because of how asynchronous transfers work, where we need to pause the connection until a reader has requested data, if no reader ever requested data (e.g. the stream was disposed without reading anything) then the connection could remain paused indefinitely, and it would sit around until the HttpClient timeout kicked in and canceled it. This could lead to unbounded growth of the number of sockets being used, as sockets couldn't be pooled or cleaned up due to still being associated with an active download. The fix is simply to cancel the request in Dispose if the request isn't already completed.

Port of #7946

We weren't canceling the request when prematurely Dispose'ing the response stream.  Because of how asynchronous transfers work, where we need to pause the connection until a reader has requested data, if no reader ever requested data (e.g. the stream was disposed without reading anything) then the connection could remain paused indefinitely, and it would sit around until the HttpClient timeout kicked in and canceled it.  This could lead to unbounded growth of the number of sockets being used, as sockets couldn't be pooled or cleaned up due to still being associated with an active download.  The fix is simply to cancel the request in Dispose if the request isn't already completed.
@Petermarcu Petermarcu merged commit eede273 into dotnet:release/1.0.0-rc2 Apr 21, 2016
@stephentoub stephentoub deleted the port7946 branch May 1, 2016 02:12
@karelz karelz added this to the 1.0.0-rc2 milestone Dec 3, 2016
@karelz karelz added the os-linux Linux OS (any supported distro) label Mar 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net os-linux Linux OS (any supported distro)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants