You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test (container.test_docker.TestDocker) ... /usr/lib/python3.8/email/feedparser.py:158: ResourceWarning: unclosed <socket.socket [closed] fd=7, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
_factory(policy=self.policy)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/lib/python3.8/email/feedparser.py:158: ResourceWarning: unclosed <socket.socket [closed] fd=8, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
_factory(policy=self.policy)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/lib/python3.8/email/feedparser.py:158: ResourceWarning: unclosed <socket.socket [closed] fd=9, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
_factory(policy=self.policy)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/lib/python3.8/email/feedparser.py:158: ResourceWarning: unclosed <socket.socket [closed] fd=10, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
_factory(policy=self.policy)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
ok
----------------------------------------------------------------------
Ran 1 test in 4.980s
OK
(i.e. not bothering to call CancellableStream.close(), but manually calling CancellableStream._response.close() appears to resolve the "ResourceWarning: unclosed <socket.socket …>" warnings; which appears to suggest that CancellableStream.close() should call self._response.close() and perhaps the rest of the current implementation that appears to be seeking a socket in order to close it is unnecessary?
This issue may, or may not, be that same as that reported in #3268.
The text was updated successfully, but these errors were encountered:
Attempting to use container.attach(stream=True) to stream logs from a container appears to leak unclosed sockets.
The following test case:
yields the following ouput:
The root cause appears to relate to a combination of APIClient._read_from_socket(…) and CancellableStream:
docker-py/docker/api/container.py
Lines 61 to 65 in a365202
The documentation for APIClient._read_from_socket(…) states:
and if
stream
is notTrue
then the implementation callsresponse.close()
:docker-py/docker/api/client.py
Lines 443 to 447 in a365202
however, the current implementation of CancellableStream.close() does not call
self._response.close()
.Modifying the test case to be:
(i.e. not bothering to call
CancellableStream.close()
, but manually callingCancellableStream._response.close()
appears to resolve the "ResourceWarning: unclosed <socket.socket …>" warnings; which appears to suggest thatCancellableStream.close()
should callself._response.close()
and perhaps the rest of the current implementation that appears to be seeking a socket in order to close it is unnecessary?This issue may, or may not, be that same as that reported in #3268.
The text was updated successfully, but these errors were encountered: