ResourceWarning: unclosed SSLSocket
See original GitHub issuewhile calling self.core_api_instance.list_namespaced_pod
method getting following warning message:
/usr/lib64/python3.5/json/decoder.py:355: ResourceWarning: unclosed <ssl.SSLSocket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('<lan-ip>', 40169), raddr=('<remote-ip>', 6443)>
obj, end = self.scan_once(s, idx)
Note:I am using unittest package in python then only above warning message is coming. Any idea reason behind it?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:15 (5 by maintainers)
Top Results From Across the Web
ResourceWarning: unclosed ssl.SSLSocket #454 - boto/boto3
For some reason I'm getting a ResourceWarning about a unclosed socket, even when I'm specifically closing the socket myself.
Read more >ResourceWarning unclosed socket in Python 3 Unit Test
Having the teardown logic in __del__ can make your program incorrect or harder to reason about, because there is no guarantee on when...
Read more >sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=4 ...
Bug 1733557 - sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr.
Read more >Issue 43885: ResourceWarning: unclosed <ssl.SSLSocket ...
... /home/heimes/dev/python/cpython/Lib/test/support/threading_helper.py:209: ResourceWarning: unclosed <ssl.SSLSocket fd=5, family=AF_INET, ...
Read more >Am I being hacked? - Google Groups
sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=1112, family=AddressFamily.AF_INET, type=SocketKind.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
While ignoring the
ResourceWarning
is one approach, a better one might be to explicitly close all the underlying connection pools that thekubernetes
client uses.Adding a
__del__
function and callingrest_client.pool_manager.clear()
seems to do the trick.thanks to @mturde. It worked for me: https://github.com/dguyhasnoname/k8s-cluster-checker/blob/master/objects/test.py