-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
This means SocketAsyncEventArgs that are pooled (as they're meant to be) and are used to establish connections can end up keeping a Socket instance alive indefinitely (until the SocketAsyncEventArgs is used for another connect operation).
This affects SocketsHttpHandler, for example. It pools SAEAs used to establish connections. If an SAEA ends up back in the pool, and new connections aren't established frequently enough to cause it to be reused, and a developers drops an HTTP/1.1 response stream before reaching the end of the response body and without disposing of it, the connection may remain open (until the server closes it or the pool reuses the SAEA for another connection).
I'm not sure how to address this without new API, e.g. a setter on ConnectSocket that can be set to null, a Clear method on SAEA that clears all such state, etc.
cc: @davidsh, @geoffkizer