aio-libs-abandoned/aioredis-py

Exception RedisError("Buffer is closed") when trying to use library with PythonParser

m-novikov opened this issue · 0 comments

Describe the bug

When using PythonParser is used attempt to call command raises an exception

To Reproduce

import aioredis
import aioredis.connection

async def run():
    redis = aioredis.from_url("redis://localhost:6379", parser_class=aioredis.connection.PythonParser)
    await redis.ping()

if __name__ == "__main__":
    asyncio.run(run())

Expected behavior

No exception is raised

Logs/tracebacks

Traceback (most recent call last):
  File "/home/novikov/src/aiohttp-bench/aioredis-py/bench.py", line 35, in <module>
    asyncio.run(run2())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/novikov/src/aiohttp-bench/aioredis-py/bench.py", line 31, in run2
    await pool.ping()
  File "/home/novikov/src/aiohttp-bench/aioredis-py/aioredis/client.py", line 1079, in execute_command
    conn = self.connection or await pool.get_connection(command_name, **options)
  File "/home/novikov/src/aiohttp-bench/aioredis-py/aioredis/connection.py", line 1410, in get_connection
    await connection.connect()
  File "/home/novikov/src/aiohttp-bench/aioredis-py/aioredis/connection.py", line 703, in connect
    await self.on_connect()
  File "/home/novikov/src/aiohttp-bench/aioredis-py/aioredis/connection.py", line 755, in on_connect
    self._parser.on_connect(self)
  File "/home/novikov/src/aiohttp-bench/aioredis-py/aioredis/connection.py", line 377, in on_connect
    raise RedisError("Buffer is closed.")
aioredis.exceptions.RedisError: Buffer is closed.

Python Version

3.9

aioredis Version

master at 33b2dbd0a40ac148e6a36ba2fc7ab5d438a9a71d

Additional context

No response

Code of Conduct

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