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

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

Closed
1 task done
m-novikov opened this issue Nov 20, 2021 · 0 comments · Fixed by #1213
Closed
1 task done
Labels

Comments

@m-novikov
Copy link
Contributor

m-novikov commented Nov 20, 2021

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
@m-novikov m-novikov added the bug label Nov 20, 2021
m-novikov added a commit to m-novikov/aioredis-py that referenced this issue Nov 20, 2021
m-novikov added a commit to m-novikov/aioredis-py that referenced this issue Nov 20, 2021
m-novikov added a commit to m-novikov/aioredis-py that referenced this issue Nov 20, 2021
m-novikov added a commit to m-novikov/aioredis-py that referenced this issue Nov 20, 2021
m-novikov added a commit to m-novikov/aioredis-py that referenced this issue Nov 20, 2021
@Andrew-Chen-Wang Andrew-Chen-Wang linked a pull request Nov 20, 2021 that will close this issue
5 tasks
Andrew-Chen-Wang pushed a commit that referenced this issue Nov 22, 2021
* Fix buffer is closed error when using PythonParser class

Fixes #1212
Fixes #1114 

* Fix test_invalid_response on older python versions without AsyncMock
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant