python-sonic-client
python-sonic-client copied to clipboard
Close connection when exception is raised
Describe the bug When server returns error, client doesn't close socket.
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/lib/python3.7/socket.py:660: ResourceWarning: unclosed <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('172.27.0.3', 42192), raddr=('172.27.0.2', 1491)>
self._sock = None
Expected behavior connection is closed before raising the error.