gobridge

0021 — Contain an MQTT recovery failure and a pre-decode ingress reject in the session

Status: accepted Date: 2026-10-05 Deciders: GoBridge core Amends: 0020 (a settlement recovery that fails after its drain, and a pre-decode ingress reject, are contained in the session instead of latching it closed; every fault this record does not name keeps the 0020 unit rebuild) Relates to: 0018 (the unit rebuild that a lease-managed session, exclusive with a lease store, can still get is an in-place reload of one reload unit), 0011 (the ingress-reject backoff uses the same stability window as the session-takeover damping and is added to the reconnect delay the same way)

Context

ADR 0020 contains an MQTT session that latched the permanent marker shared.ErrTransportClosedPermanently: the composition root rebuilds the reload unit that holds the session. That is a heavy answer. Every receiver, sender, binding and route joined to the session stops and is built again, after the per-session rebuild backoff (1 s doubling to 30 s, with equal jitter, so the first wait lies between 0.5 s and 1 s). ADR 0020 left the transport side of two of its MQTT faults unchanged and deferred it to a record of its own. This is that record.

  1. A settlement recovery that fails after its drain. A settlement recovery recycles the broker connection of a Persistent or Exclusive session so the broker redelivers a delivery that was received but never settled (MQTT settlement recovery). Before it disconnects, the recovery drains: it stops ingress and waits until every delivery the runtime accepted has settled or stopped. Every step after the drain could fail the session closed: the reconnect, a CONNACK with Session Present = false, a recovery connection that a newer connection replaced, and the reconcile that re-subscribes. A broker that dropped the connection during a recovery, or that had forgotten the session, was enough to rebuild the whole unit.
  2. A pre-decode ingress reject. The paho session wraps the broker connection in a guard that reads each inbound packet before Paho decodes it. The guard rejects a packet that is malformed, or that is larger than the Maximum Packet Size the client advertised in CONNECT. A compliant broker never sends either. The reject latched the session closed. A broker that sends the packet again on every resume fails every fresh session the same way, so the ADR 0020 rebuild would repeat for as long as the broker does it.

Decision

Both faults are contained in the paho session. The session does not go terminal and emits no SessionError. ADR 0020 still applies when an abandoned recovery leaves a lease-managed session with no connection, and when a step of the recovery fails closed in a way that is terminal outside a recovery too.

A settlement recovery that fails after its drain

A pre-decode ingress reject

Safety

A session latches terminal so that old route work cannot act after the session is replaced. ADR 0020 relies on two guarantees for that. Both still hold.

  1. No new broker connection while old route work can still act. The guarantee covers the connection a recovery recycle or a replacing session opens, not the reconnect autopaho makes inside the same session after a network fault. A recovery is abandoned only after its drain finished, when every delivery the runtime accepted from the old connection is settled or stopped, so no route work of the old connection exists. A pre-decode reject adds no route work: the rejected packet never reached Paho’s decoder, so it never reached a route. The reject itself replaces no session. The connection the reject drops is the ordinary one autopaho reconnects, like a connection a network fault drops, which never made a session terminal; the deliveries still held from it settle as they do after any reconnect.
  2. No lease release while old work can still act. A failed drain still latches the session terminal, and the lease rules of ADR 0020 apply. A lease-managed session that an abandoned recovery leaves with no connection releases its lease only after the completed drain, when the old work has already stopped. A pre-decode reject does not end the session: the session manager sees an ordinary disconnect and reconnect, and the lease follows the rules for any broker outage. When the reject fails the reconcile after a reconnect, the lease follows the existing rule for a failed reconcile: the source session closes and the settlement grace passes before the release.

Consequences

Rejected alternatives