Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

BlockingConnectionPool exception on disconnect #1047

Closed
abrookins opened this issue Jul 4, 2021 · 0 comments · Fixed by #1068
Closed

BlockingConnectionPool exception on disconnect #1047

abrookins opened this issue Jul 4, 2021 · 0 comments · Fixed by #1068

Comments

@abrookins
Copy link
Contributor

A user (@erewok) was trying to use BlockingConnectionPool from v2.0.0.a1 in places where ConnectionPool is working fine and kept hitting an exception on disconnect:

  File "/location/of/dependencies/lib/python3.9/site-packages/aioredis/connection.py", line 1596, in disconnect
    async with self._lock:
AttributeError: 'BlockingConnectionPool' object has no attribute '_lock'

This is in this chunk of code: https://github.com/aio-libs/aioredis-py/blob/c54fca02e216f0fb046b83e6403315fb00cd43e6/aioredis/connection.py#L1598

It looks like the direct reason for this is that on __init__ a regular ConnectionPool ends up calling reset, which sets the following attributes:

        self._lock = asyncio.Lock()
        self._created_connections = 0
        self._available_connections = []
        self._in_use_connections = set()

However, the BlockingConnectionPool does something different in its reset method: https://github.com/aio-libs/aioredis-py/blob/c54fca02e216f0fb046b83e6403315fb00cd43e6/aioredis/connection.py#L1491

I am probably going to use ConnectionPool for now: I think the BlockingConnectionPool isn't totally usable yet.

Originally posted by @erewok in #930 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant