ERM redis resource_error ai_generated true

ERR 客户端:订阅者队列已满 - 丢弃消息

ERR Client: subscriber queue full - dropping message

ID: redis/pubsub-subscriber-queue-full

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

版本兼容性

版本状态引入弃用备注
Redis 6.2.0 active
Redis 7.0.0 active
Redis 7.2.0 active

根因分析

发布/订阅订阅者客户端的输出缓冲区已满,导致 Redis 丢弃消息以防止客户端断开连接。

English

A Pub/Sub subscriber client's output buffer is full, causing Redis to drop messages to prevent the client from being disconnected.

generic

官方文档

https://redis.io/docs/latest/develop/interact/pubsub/

解决方案

  1. Increase the client output buffer limit for Pub/Sub clients: CONFIG SET client-output-buffer-limit pubsub 32mb 8mb 60. This provides more headroom for message bursts.
  2. Implement backpressure in the subscriber: use a message queue (e.g., Redis list) to buffer messages asynchronously. Example in Python: import redis; r = redis.Redis(); pubsub = r.pubsub(); pubsub.subscribe('channel'); for msg in pubsub.listen(): r.rpush('buffer', msg['data'])
  3. Add more subscriber instances to distribute the load: run multiple worker processes each subscribing to a subset of channels.

无效尝试

常见但无效的做法:

  1. 85% 失败

    Setting an unlimited buffer can cause Redis to run out of memory, leading to OOM kills or performance degradation.

  2. 60% 失败

    Disabling processing does not address the queue full issue; the client will still fail to consume messages fast enough.

  3. 70% 失败

    A single subscriber handling many channels increases message volume per client, worsening the queue full condition.