ERM redis resource_error ai_generated true

ERR Client: subscriber queue full - dropping message

ID: redis/pubsub-subscriber-queue-full

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
1Evidence
2024-05-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Redis 6.2.0 active
Redis 7.0.0 active
Redis 7.2.0 active

Root Cause

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

generic

中文

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

Official Documentation

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

Workarounds

  1. 85% success 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.
    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. 90% success 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'])
    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. 80% success Add more subscriber instances to distribute the load: run multiple worker processes each subscribing to a subset of channels.
    Add more subscriber instances to distribute the load: run multiple worker processes each subscribing to a subset of channels.

中文步骤

  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.

Dead Ends

Common approaches that don't work:

  1. 85% fail

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

  2. 60% fail

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

  3. 70% fail

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