-
Notifications
You must be signed in to change notification settings - Fork 2.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
ResourceWarning: unclosed <ssl.SSLSocket fd=20, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.1.0.62', 52098), raddr=('52.239.140.10', 443)> #14565
Comments
Hi @lukin0110 So you also saw this warning when only executing this two lines?
|
Hi @xiafu-msft The correct way to reproduce is:
|
Hi @lukin0110 Thanks for your code!
|
Heh @xiafu-msft, Using it as a context is still showing the warning. |
Hi @lukin0110 Thanks for reporting this issue. I was able to reproduce. @xiangyan99 could you please find people to confirm we want to close the session before return. |
Thanks for the quick follow up! |
Hi @lukin0110, this is actually intended behavior. When you run
You're creating a blob client from your BlobServiceClient and not closing any sessions.
This ensures that the socket is closed since the child class is inheriting the same session. You can also do:
Hope this helps! |
@tadam-msft thanks for clarifying. I've applied your suggestion. The resource warning is not appearing anymore. |
Hi @lukin0110! fantastic :) |
Describe the bug
We've enabled a few warning filters in our application with
warning.simplefilter
and we're seeing a python warning when we download a file from the blob storage.ResourceWarning: unclosed <ssl.SSLSocket fd=20, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.1.0.62', 52098), raddr=('52.239.140.10', 443)>
To Reproduce
Expected behavior
No warning or a proper way to close the stream.
Screenshots
NA
Additional context
NA
The text was updated successfully, but these errors were encountered: