Skip to content

Bug: When the redis server is killed, faststream can't recover #2611

@pbonneaudiabolocom

Description

@pbonneaudiabolocom

Describe the bug
Today, my redis server was killed.
Almost immediately, it was back alive and the data were flowing properly from the sender.

But faststream stayed stuck, complaining the group was not existing.

How to reproduce

  • create a subscriber with a stream and consumer group on redis
  • launch the application
  • kill redis + empty it (if not done by the kill)
  • faststream is sending the following message:
2025-10-23T14:38:01.670669760Z 2025-10-23 16:38:01,670 ERROR    -                     |            - Message fetch error
2025-10-23T14:38:01.670708509Z Traceback (most recent call last):
2025-10-23T14:38:01.670717162Z   File "/venv/lib/python3.12/site-packages/faststream/redis/subscriber/usecases/basic.py", line 94, in _consume
2025-10-23T14:38:01.670722550Z     await self._get_msgs(*args)
2025-10-23T14:38:01.670727037Z   File "/venv/lib/python3.12/site-packages/faststream/redis/subscriber/usecases/stream_subscriber.py", line 289, in _get_msgs
2025-10-23T14:38:01.670732145Z     for stream_name, msgs in await read(self.last_id):
2025-10-23T14:38:01.670737974Z                              ^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-23T14:38:01.670747609Z   File "/venv/lib/python3.12/site-packages/redis/asyncio/client.py", line 616, in execute_command
2025-10-23T14:38:01.670758445Z     return await conn.retry.call_with_retry(
2025-10-23T14:38:01.670787409Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-23T14:38:01.670793789Z   File "/venv/lib/python3.12/site-packages/redis/asyncio/retry.py", line 59, in call_with_retry
2025-10-23T14:38:01.670798466Z     return await do()
2025-10-23T14:38:01.670804846Z            ^^^^^^^^^^
2025-10-23T14:38:01.670808882Z   File "/venv/lib/python3.12/site-packages/redis/asyncio/client.py", line 590, in _send_command_parse_response
2025-10-23T14:38:01.670813128Z     return await self.parse_response(conn, command_name, **options)
2025-10-23T14:38:01.670816964Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-23T14:38:01.670820890Z   File "/venv/lib/python3.12/site-packages/redis/asyncio/client.py", line 637, in parse_response
2025-10-23T14:38:01.670825317Z     response = await connection.read_response()
2025-10-23T14:38:01.670829794Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-23T14:38:01.670834331Z   File "/venv/lib/python3.12/site-packages/redis/asyncio/connection.py", line 577, in read_response
2025-10-23T14:38:01.670838778Z     raise response from None
2025-10-23T14:38:01.670843765Z redis.exceptions.ResponseError: NOGROUP No such key 'global_input-stream' or consumer group 'call_activity_managers' in XREADGROUP with GROUP option

Expected behavior
I expect Faststream to detect the missing group and recreate it to recover the connection, in order to keep working as usual.
Throwing an error would be appreciated as well.

Observed behavior
FastStream application is dead

Environment
Faststream 0.6.1 on alpine docker image

Additional context
Redis being an in-memory DB, I think the reader need to make sure it can recover when redis is back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions