Response<T> is not disposable causing leaked TCP connections.
See original GitHub issueDescribe the bug
Response<T>
contains a disposable field but is not itself disposable. This is a huge problem because the object indirectly contains a HttpResponseMessage. HttpResponseMessage objects are one of the most important types to dispose because they hold on to TCP connections.
Exception or Stack Trace N/A
To Reproduce
Try to put a Response<T>
in a using.
Code Snippet https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/src/Response{T}.cs#L14
Expected behavior
Response<T>
should be disposable so that HttpResponseMessage objects can be properly disposed.
Screenshots N/A
Setup (please complete the following information):
- OS: all
- IDE : any
- 1.0.1
Additional context Add any other context about the problem here.
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Bug Description Added
- Repro Steps Added
- Setup information Added
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@AlexandreArpin, you are doing the right thing here.
DownloadAsync
is one of the few client methods that return “live” network stream that has to be either read to the end or disposed.@pakrym
Currently reviewing our dispose patterns and
using
in our applications since we sometimes have DisposedExceptions.We have a pretty big throughput of blobs in our applications, does your comment means the Client ensure the response’s stream are correctly disposed?
Currently, we’re doing the following
Is this not advised?