Skip to content

KeyError: 'first-entry' in parse_xinfo_stream #2768

Closed
@knkski

Description

@knkski

Version:

redis-py 4.4.3, redis server 7.0.7

Platform:

redis-py on various flavors of Linux (Debian and Ubuntu), redis server in AWS

Description:
Sometimes, I get this traceback:

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  .. fastapi stuff elided ...
  File "/serve.py", line 187, in fetch_key
    info = await r.xinfo_stream(key)
  File "venv/lib/python3.9/site-packages/redis/asyncio/client.py", line 505, in execute_command
    return await conn.retry.call_with_retry(
  File "venv/lib/python3.9/site-packages/redis/asyncio/retry.py", line 59, in call_with_retry
    return await do()
  File "venv/lib/python3.9/site-packages/redis/asyncio/client.py", line 481, in _send_command_parse_response
    return await self.parse_response(conn, command_name, **options)
  File "venv/lib/python3.9/site-packages/redis/asyncio/client.py", line 536, in parse_response
    retval = self.response_callbacks[command_name](response, **options)
  File "venv/lib/python3.9/site-packages/redis/client.py", line 323, in parse_xinfo_stream
    first = data["first-entry"]
KeyError: 'first-entry'

I haven't gotten it down to a reproducible test case, as it only happens occasionally. The request is automatically retried and works at some point, possibly the second time but it's hard to say for sure. It seems to be some race condition between the stream being created, and info about the stream being available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions