Closed
Description
Version: redis-py 5.2.1
Platform: MacOS 15.1.1 (24B91)
Description: I have this issue when using django and redis-py.
CACHE settings are:
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"OPTIONS": {
"CONNECTION_POOL_CLASS": "redis.BlockingConnectionPool",
"CONNECTION_POOL_KWARGS": {
"max_connections": 50,
"timeout": 20,
"protocol": 3,
"cache_config": CacheConfig(),
},
"PICKLE_VERSION": -1,
},
...
}
}
StackTrace is
File "/.venv/lib/python3.11/site-packages/django_redis/client/default.py", line 258, in get
value = client.get(key)
^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/redis/commands/core.py", line 1822, in get
return self.execute_command("GET", name, keys=[name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/redis/client.py", line 559, in execute_command
return self._execute_command(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/redis/client.py", line 565, in _execute_command
conn = self.connection or pool.get_connection(command_name, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/redis/connection.py", line 1634, in get_connection
connection = self.make_connection()
^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.11/site-packages/redis/connection.py", line 1599, in make_connection
self.connection_class(**self.connection_kwargs), self.cache, self._lock
^^^^^^^^^^
It seems that in BlockingConnectionPool
, self._lock is not set in the init method. The base class ConnectionPool set it in the reset
method: https://github.com/redis/redis-py/blob/v5.2.1/redis/connection.py#L1346, while BlockingConnectionPool
doesn't: https://github.com/redis/redis-py/blob/v5.2.1/redis/connection.py#L1571
Metadata
Metadata
Assignees
Labels
No labels