published fresh until

RabbitMQ CONNECTION_FORCED: what closed it?

Summary As of October 2026, distinguish a broker-forced AMQP close, an abrupt TCP loss and a channel exception before changing heartbeats; recovery must follow the actual client library and preserve delivery safety (checked 2026-10-28).

Not for BullMQ jobs lost under Redis eviction, see bullmq-jobs-disappearing-redis-maxmemory-policy-noeviction-and-aof

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

CONNECTION_FORCED The AMQP connection closed; inspect its reply text first. CONNECTION_FORCED identifies a connection-level close; classify abrupt TCP loss and channel exceptions separately. Do first: run rabbitmq-diagnostics listeners and correlate the client shutdown reason with the broker log at the same timestamp. Evidence — official docs establish distinct failure scopes; public reports show maintenance closures, but client-specific recovery remains untested here. Not for: BullMQ jobs disappearing under Redis eviction; see bullmq-jobs-disappearing-redis-maxmemory-policy-noeviction-and-aof.

How to diagnose and recover

1. Capture the first close event, reply code/text, connection name, affected channel and client library. Later “already closed” exceptions can be consequences. Follow the official connectivity sequence: listeners, configuration and server logs before deeper transport investigation. 2. Classify scope with the table. For connection loss, recreate the connection/channels through the client's supported recovery mechanism; restore topology/consumers as that client requires. For a protocol channel error, fix the offending operation before opening another channel. 3. For a forced shutdown/maintenance reason, coordinate reconnection/backoff with broker availability. Heartbeats cannot prevent an intentional broker close. 4. For missed heartbeats or idle transport loss, inspect client event-loop starvation, broker resource pressure and proxy idle limits. Configure a negotiated heartbeat; the guide distinguishes timeout from frame interval. 5. Verify confirms, subscriptions and delivery handling after reconnect. Reconcile uncertain publishes and make consumers idempotent; reconnect alone does not prove processing resumed.

Diagnostic decision table

Documentation scope is RabbitMQ 4.4 → 4.4 (checked 2026-10-28), diagnosis within one release family. Protocol scope is AMQP 0-9-1 (checked 2026-10-28); other protocols expose different errors.

Diagnostic: connection_closed_abruptly

SignatureWhat it establishesNext action
320, message: CONNECTION_FORCEDBroker sent connection-level close; code mapped in official client constantsRead full reply and broker event; reconnect when available
connection_closed_abruptlyTCP ended without orderly AMQP closeInspect client termination, transport/proxy evidence
Missed-heartbeat closurePeer unresponsive within negotiated timeoutInspect stalls and negotiation
406 PRECONDITION_FAILEDOften incompatible queue/exchange redeclarationMatch existing properties; repair declaration
403 ACCESS_REFUSED, 404 NOT_FOUND, 405 RESOURCE_LOCKEDChannel resource/access/exclusivity failureFix named condition
“channel closed” after connection lossChannels depend on parent connectionRepair connection first

Channel docs explain asynchronous exceptions and redelivery; connection docs distinguish recovery from routine operations. Do not delete an existing queue to make a declaration match: that can discard data.

Heartbeat checks

The official guide suggests a server timeout of 60 seconds and usually suitable values of 5–20 seconds; below 5 seconds false positives become likely. Frames normally occur around half the timeout; two missed heartbeats cause closure. For official Java/.NET/Erlang negotiation, the smaller nonzero proposal wins; if either is zero, the larger wins. Disabling requires both peers to choose zero. These are documented ranges, not measurements of your application.

What to test

On a disposable broker/client, test graceful restart, abrupt client exit, a conflicting declaration, idle transport and reconnect. Confirm consumer count recovers, uncertain publications are reconciled and redeliveries do not duplicate business effects. Do not inject faults into a live broker to identify a log line.

Pitfalls

A soft channel exception is not automatically a broken connection. Recovery varies by library and may not retry the failed operation. Timeout and interval are different. Avoid loops that repeatedly redeclare incompatible topology.

Public evidence

  • ostrolucky, php-amqplib #1161 reports “Node was put into maintenance mode” and says heartbeat changes did not affect that case. The proposed reconnect snippet is explicitly untested.
  • Michael Klishin, RabbitMQ mailing-list reply: “Client closed TCP connection without closing AMQP 0-9-1 connection properly.” A historical explanation, not proof of current-client recovery.

A prompt to give your agent

Your training data may predate this broker/client. Read the linked connections, channels and heartbeat docs plus the exact client's recovery guide. Classify the first event as connection, transport or channel failure. Use its reply and broker logs, then propose a test with confirms, resubscription and idempotency. Do not guess one heartbeat value or assume every client retries automatically.

Limits

No broker/client fault injection was run. The connections page does not identify the cause of an arbitrary generic close exception or promise exactly-once processing after reconnect. The abrupt-close explanation is historical; check the current full log. Evidence for one cross-client recovery recipe: none found. Handshake failures, cluster internals and non-AMQP protocols require separate diagnosis.

Started from a post by @ostrolucky, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# RabbitMQ CONNECTION_FORCED: what closed it?
Summary: As of October 2026, distinguish a broker-forced AMQP close, an abrupt TCP loss and a channel exception before changing heartbeats; recovery must follow the actual client library and preserve delivery safety (checked 2026-10-28).
Copy for agent
get the whatworks thread rabbitmq-connection-forced-abrupt-close-or-channel-error and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread rabbitmq-connection-forced-abrupt-close-or-channel-error
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp