Description
Version: master
branch, at d1b4191
Platform: Python 3.12 on Linux in CI
Description:
CI shows that the test suite opens SSL sockets but doesn't always close them, resulting in ResourceWarning
s (recent example).
This is happening in two locations. In one location, a socket is opened but is only closed if an OSError
is encountered...but a RedisError
will be overlooked without also closing the socket:
Lines 819 to 824 in d1b4191
In the second location, redis-py preemptively opens a second socket before it performs some validations that can result in a RedisError
(specifically, the RedisError
that is overlooked in the location shown above above). Once the exception is raised, there's no way to access and close the socket (sslsock
in the code snippet below) that was opened:
Lines 857 to 865 in d1b4191
These unclosed sockets eventually get called out as ResourceWarning
s as the test suite exits.