Closed
Description
Version: master
branch, at d1b4191
Platform: Python 3.12 on Linux in CI
Description:
CI shows that there is an unclosed Unix socket when the test suite exits, which manifests as a ResourceWarning
(recent example).
This is happening because redis-py isn't closing the Unix socket when the call to sock.connect()
fails:
Lines 919 to 925 in d1b4191
The socket instance needs to be closed immediately if the call to sock.connect()
fails, while the object can still be referenced.
You can recreate this situation with this trivial reproducer:
$ python -Walways -c 'import socket; socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)'
<string>:1: ResourceWarning: unclosed <socket.socket fd=3, family=1, type=1, proto=0>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Metadata
Assignees
Labels
No labels