# ERR 消费者组 'mygroup' 在流 'mystream' 上的待处理条目列表过大：50000 条，请考虑修剪

- **ID:** `redis/stream-pending-entry-list-too-large`
- **领域:** redis
- **类别:** resource_error
- **错误码:** `ERR`
- **验证级别:** ai_generated
- **修复率:** 79%

## 根因

消费者组的待处理条目列表（PEL）增长过大，消耗内存并拖慢 XREADGROUP 和 XACK 操作。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 7.2.0 | active | — | — |
| 7.4.0 | active | — | — |
| 8.0.0 | active | — | — |

## 解决方案

1. ```
   Use XAUTOCLAIM to reclaim and acknowledge old pending entries: 'XAUTOCLAIM mystream mygroup myconsumer 3600000 0-0 COUNT 1000' then XACK each claimed entry. Repeat until PEL is reduced.
   ```
2. ```
   Implement a periodic cleanup job in the consumer that checks PEL size via XINFO GROUPS and automatically trims old entries using XDEL after confirming they are no longer needed
   ```

## 无效尝试

- **Increasing maxmemory to accommodate the large PEL** — This only delays the problem; the PEL will continue to grow until memory is exhausted again, and it does not improve performance. (80% 失败率)
- **Deleting the consumer group and recreating it** — This loses all pending entry state, potentially causing data loss if entries were not processed. (90% 失败率)
- **Setting a very high XREADGROUP COUNT to read more entries** — This increases load on the server and does not reduce the PEL size; it may actually grow it faster. (70% 失败率)
