aioredis-py icon indicating copy to clipboard operation
aioredis-py copied to clipboard

TimeoutError: Timed out closing connection after None

Open Olegt0rr opened this issue 2 years ago • 3 comments

Describe the bug

After switch to aioredis v2 start to receiving an error: TimeoutError: Timed out closing connection after None

The same code on <2 dependency works without any errors! Average redis load ~2.5k RPS Redis server working via SaaS and has no troubles with availability and resources

To Reproduce

Don't know how...

Expected behavior

aioredis works fine similar to the previous version

Logs/tracebacks

TimeoutError: Timed out closing connection after None
...
  File "aiogram/contrib/fsm_storage/redis.py", line 265, in get
    return await self._redis.get(name, **kwargs)
  File "aioredis/client.py", line 1082, in execute_command
    conn = self.connection or await pool.get_connection(command_name, **options)
  File "aioredis/connection.py", line 1425, in get_connection
    await connection.disconnect()
  File "aioredis/connection.py", line 812, in disconnect
    raise TimeoutError(

Python Version

$ python --version
CPython
3.9.10(3.9.10 (main, Jan 29 2022, 04:19:45) 
[GCC 10.2.1 20210110])

aioredis Version

$ python -m pip show aioredis
2.0.1

Additional context

No response

Code of Conduct

  • [X] I agree to follow the aio-libs Code of Conduct

Olegt0rr avatar Feb 10 '22 21:02 Olegt0rr

Workaround

To avoid this exception I limit connections amount with max_connections. But it's not a solution for this behaviour

Olegt0rr avatar Feb 12 '22 18:02 Olegt0rr

Does the problem still occur on master branch? I suspect you're not disconnecting the connection pool (on master, it should be auto disconnecting when you call Redis.disconnect)

Andrew-Chen-Wang avatar Feb 12 '22 18:02 Andrew-Chen-Wang

@Andrew-Chen-Wang, can't test this behaviour in my production anymore, cause it was butthurt for me :hurtrealbad: As soon as new version will be released, it will be implemented on my staging and the I'll try to check it with my testers. Thanks for response!

Olegt0rr avatar Feb 12 '22 19:02 Olegt0rr