redis
runtime_error
ai_generated
partial
ERR Error claiming messages for consumer 'consumer1' on stream 'mystream': timeout
ID: redis/stream-group-claim-timeout
78%Fix Rate
85%Confidence
1Evidence
2024-03-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Redis 7.2.0 | active | — | — | — |
| Redis 7.4.0 | active | — | — | — |
| Redis Stack 7.2.0 | active | — | — | — |
Root Cause
The XCLAIM command timed out because the pending entries list (PEL) is too large or the consumer group is under heavy load, preventing the claim operation from completing within the idle timeout.
generic中文
XCLAIM 命令超时,因为待处理条目列表 (PEL) 过大或消费者组负载过高,导致认领操作无法在空闲超时时间内完成。
Official Documentation
https://redis.io/commands/xclaim/Workarounds
-
80% success Use XINFO GROUPS and XINFO CONSUMERS to inspect the PEL size, then trim pending entries with XTRIM or XDEL for acknowledged messages. For example: XINFO GROUPS mystream, then XDEL mystream <id1> <id2> for stale entries.
Use XINFO GROUPS and XINFO CONSUMERS to inspect the PEL size, then trim pending entries with XTRIM or XDEL for acknowledged messages. For example: XINFO GROUPS mystream, then XDEL mystream <id1> <id2> for stale entries.
-
75% success Increase the consumer group's idle timeout via the 'idle' parameter in XCLAIM, but also implement a background job to periodically clean up the PEL using XAUTOCLAIM with a reasonable count.
Increase the consumer group's idle timeout via the 'idle' parameter in XCLAIM, but also implement a background job to periodically clean up the PEL using XAUTOCLAIM with a reasonable count.
-
85% success Scale out consumers to reduce per-consumer PEL size, or use stream partitioning to distribute load across multiple streams.
Scale out consumers to reduce per-consumer PEL size, or use stream partitioning to distribute load across multiple streams.
中文步骤
使用 XINFO GROUPS 和 XINFO CONSUMERS 检查 PEL 大小,然后通过 XTRIM 或 XDEL 修剪待处理条目。例如:XINFO GROUPS mystream,然后对过期条目执行 XDEL mystream <id1> <id2>。
通过 XCLAIM 的 'idle' 参数增加消费者组的空闲超时,同时实现后台任务定期使用 XAUTOCLAIM 清理 PEL,设置合理的 count 参数。
扩展消费者数量以减少每个消费者的 PEL 大小,或使用流分区将负载分散到多个流上。
Dead Ends
Common approaches that don't work:
-
60% fail
Increasing the idle timeout for XCLAIM may hide the symptom but doesn't address the root cause of PEL bloat or consumer lag.
-
80% fail
Manually deleting large PEL entries without understanding the consumer group state can cause message loss or duplicate processing.
-
70% fail
Restarting the consumer group or Redis instance may temporarily clear the timeout but the PEL will rebuild from pending messages, leading to recurrence.