320
communication
connection_error
ai_generated
true
AMQPConnectionError: 连接强制关闭 (320) CONNECTION_FORCED
AMQPConnectionError: connection forced (320) CONNECTION_FORCED
ID: communication/amqp-connection-forced
83%修复率
86%置信度
1证据数
2023-09-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| RabbitMQ 3.11 | active | — | — | — |
| RabbitMQ 3.12 | active | — | — | — |
| RabbitMQ 3.13 | active | — | — | — |
根因分析
AMQP 代理(如 RabbitMQ)因资源告警(内存或磁盘)或内部错误强制关闭连接,通常由 connection.blocked 方法指示。
English
The AMQP broker (e.g., RabbitMQ) forcibly closed the connection due to a resource alarm (memory or disk) or an internal error, often signaled by the connection.blocked method.
官方文档
https://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.forced解决方案
-
Check broker resource alarms via `rabbitmq-diagnostics check_alarms` and free up memory/disk. For memory: reduce queue sizes or set `vm_memory_high_watermark` lower. For disk: increase `disk_free_limit`.
-
Implement connection recovery with backoff and listen to `connection.blocked` event. In Pika (Python): `connection.add_on_connection_blocked_callback(lambda c: time.sleep(10))`.
无效尝试
常见但无效的做法:
-
80% 失败
Restarting the client without checking broker resources leads to immediate reconnection and re-disconnection.
-
90% 失败
Increasing connection timeout doesn't address the underlying resource exhaustion.
-
70% 失败
Adding more consumer instances worsens resource pressure by creating more connections.