ERR redis data_error ai_generated true

错误:流条目已添加到消费者组待处理条目列表但未确认

Error: Stream entries added to consumer group PEL without acknowledgment

ID: redis/stream-entries-added-to-consumer-group-pel

其他格式: JSON · Markdown 中文 · English
85%修复率
85%置信度
1证据数
2024-03-15首次发现

版本兼容性

版本状态引入弃用备注
redis 6.2 active
redis 7.0 active
redis 7.2 active

根因分析

消费者组待处理条目列表(PEL)因消费者未能确认已处理的消息而无限制增长,可能导致内存耗尽和性能下降。

English

Consumer group pending entries list (PEL) grows unbounded as consumers fail to acknowledge processed messages, potentially causing memory exhaustion and performance degradation.

generic

官方文档

https://redis.io/docs/latest/commands/xack/

解决方案

  1. Periodically acknowledge processed entries using XACK: `XACK mystream mygroup 1526569498055-0` for each message ID. Automate with a background job that calls XACK after successful processing.
  2. Set a consumer group PEL size limit with `XGROUP SETID mystream mygroup $` and use XTRIM to cap stream length: `XTRIM mystream MAXLEN ~ 10000`.
  3. Use XAUTOCLAIM to reassign idle PEL entries to other consumers: `XAUTOCLAIM mystream mygroup consumer2 3600000 0-0` after setting a reasonable idle timeout.

无效尝试

常见但无效的做法:

  1. Increasing consumer group size to handle more messages 85% 失败

    Adding more consumers does not clear the PEL; each consumer still accumulates unacknowledged entries, worsening the issue.

  2. Deleting and recreating the stream 90% 失败

    Deletes all data and disrupts active consumers; PEL rebuilds quickly if root cause (lack of acknowledgment) persists.

  3. Setting XREADGROUP COUNT to a very high value 80% 失败

    High COUNT does not clear PEL; it only returns more entries, and unacknowledged entries remain, continuing to grow the PEL.