Files
FFF_vtt_frozen/docs/adr/0017-bounded-outbox-stop-feed-resync.md
SirStone 8aaf03be04 docs: add ADRs for the durable design decisions
22 ADRs: server-authoritative sight and single egress, per-recipient views/diffs, uniform
nack, opaque ids, 32 px tile unit, wall switches/presets, see-over, thick walls, open-door
gap, typed wall columns, proto 2, build order, zoom clamp, accepted status leak, player
marker, chunked explored, slow-client policy, session/key split, closing message, character
records, global lock, synchronous choice. Each links its tickets and its spec section.
2026-11-17 23:12:04 +01:00

1.4 KiB

Slow clients are stopped and resynced, never closed for lag

Each connection has an app-level bounded outbox (byte and message caps) keyed by an app connId, with latest-state-wins coalescing per state key and the diff computed at flush time. WS Ping(seq)/Pong measures lag; a client over the cap or without a timely Pong stops being fed and is fully resynced when it recovers. Lag never closes a connection; a peer that never recovers is closed by the nginx proxy timeout. We chose this over closing slow clients because at the mummy 0.4.8 pin there is no per-socket queue visibility, no forced close, and close(ws) queues behind the backlog.

Status

accepted

Alternatives

  • Patch or fork mummy for per-socket depth and forced close: fallback only, not planned.
  • Close a client when lag exceeds a bound: impossible at the pin, and it loses a phone that was briefly backgrounded.
  • Drop state messages with no resync: rejected, the client would silently diverge.

Consequences

Memory per connection is bounded by the caps; a stopped client's state is rebuilt from its known table on recovery, so a dropped intermediate state cannot desynchronise it. Ordering between a state message and an ack is flush order, not mutation order (ADR-0002). The connection limits (4 per player, 16 total) are enforced separately.

Tickets

Q13, #18, #15; research docs/research/q13-mummy-slow-clients.md.

Spec

Current §4.3, §6.3, §6.4.