redis resource_error ai_generated true

错误:客户端命令队列已满,断开连接

ERR: Command queue full for client, dropping connection

ID: redis/command-queue-full

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

版本兼容性

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

根因分析

客户端的命令缓冲区超过了客户端输出缓冲区限制,导致 Redis 断开连接以防止内存耗尽。

English

A client's command buffer exceeded the client-output-buffer-limit, causing Redis to disconnect it to prevent memory exhaustion.

generic

官方文档

https://redis.io/docs/latest/develop/reference/clients/

解决方案

  1. 检查客户端的应用程序逻辑:使用管道或批处理减少每个连接发送的命令数量。例如:在 Python 中使用 redis-py 的 pipeline。
  2. 使用 CLIENT LIST 监控慢消费者,并考虑增加特定客户端类型的客户端输出缓冲区限制:CONFIG SET client-output-buffer-limit 'normal 0 0 0'(重置为默认值)。

无效尝试

常见但无效的做法:

  1. Increase client-output-buffer-limit to a very high value (e.g., 1GB) 45% 失败

    May hide the underlying issue (e.g., slow consumer or large replies) and risk OOM on Redis server.

  2. Restart Redis server to clear all client connections 60% 失败

    Temporary fix; the issue will recur if the client behavior isn't changed.