# FIX ResendRequest (35=2) & GapFill (35=4) Storm Control

> Prevent FIX replay storms after TCP packet drops by coalescing administrative frames into SequenceReset-GapFill (35=4, 123=Y) and suppressing stale orders.

Canonical: https://terminalledgerdesk.com/reports/fix-resend-request-tag-35-2-sequence-reset-gap-fill-storm-control
Last updated: 2026-11-15T06:40:18.641Z

**Publication:** Terminal Ledger Desk
**Category:** Fix Protocol Sbe Ouch Session Latency
**Published:** 2026-11-14T15:50:25.915Z
**Author:** Marcus Thorne, CQF (Certificate in Quantitative Finance (CQF), Low-Latency FIX & Matching Engine Architect)
**Reviewer:** Not recorded

## Answer-first summary

Uncoalesced FIX ResendRequest (35=2) loops after a 4-second firewall blip can trigger 50,000+ disk reads and stale order transmissions unless gateways collapse skipped numbers via SequenceReset-GapFill (35=4, GapFillFlag=Y).

## Key takeaways

- Coalescing skipped heartbeats, quotes, and aged orders into contiguous SequenceReset-GapFill (35=4, 123=Y) blocks cuts post-blip replay bytes by over 250x.
- Outbound trading gateways must intercept NewOrderSingle (35=D) and CancelReplace (35=G) messages older than 50–250 ms during ResendRequest handling to prevent toxic stale fills.
- Always issue EndSeqNo=0 (Tag 16) alongside an in-memory out-of-order ring buffer in FIX 4.2+ and FIXT.1.1 so recovery transitions cleanly back to live traffic in one pass.
- Hard SequenceReset-Reset (35=4, 123=N) bypasses sequence continuity checks and must be blocked intraday to prevent silent loss of unacknowledged ExecutionReports.

## Related financial entities

- **Financial Information eXchange (FIX) Protocol** (FIX-4.4) — product: Electronic communications protocol initiated in 1992 for international real-time exchange of securities transaction and market data information.
- **FIX Protocol Session Layer Specification (FIXT.1.1)** (FIXT-SESSION) — product: Bi-directional, stateful session communication protocol providing guaranteed, ordered message delivery for financial transactions.
- **High-Availability Trading Failover Architecture** (HA-CLUSTER) — product: Clustered server configuration designed to guarantee uninterrupted execution processing even during sudden hardware failure, power loss, or network partitions.

## Analysis

When a transient BGP flap or firewall state-table failover stalls a high-throughput FIX connection for just 3.5 seconds during the US cash open, an active liquidity provider can advance 18,000 sequence numbers ahead of the downstream OMS. If both peers naively exchange overlapping `ResendRequest (35=2)` frames (`BeginSeqNo 7`, `EndSeqNo 16=0`) and replay individual `Heartbeat (35=0)` or stale `MassQuote (35=i)` messages from disk, socket send buffers saturate, triggering cascading timeouts. Institutional session engines eliminate replay amplification by coalescing every non-fill record into a single contiguous `SequenceReset-GapFill` (`35=4`, `GapFillFlag 123=Y`, `NewSeqNo 36`).

## Protocol Rules Governing ResendRequest (35=2) & Infinity EndSeqNo

Under the [FIX session layer specification](/engines/fix-session-layer-specification), every inbound frame's `MsgSeqNum (34)` is compared strictly against `NextExpectedMsgSeqNum`. If `MsgSeqNum > NextExpectedMsgSeqNum`, an out-of-order gap exists: the engine must queue or discard the higher-numbered message (depending on optimistic vs strict in-order buffering) and emit `ResendRequest (35=2)`.

Version nuances matter here. In FIX 4.0 and 4.1, `EndSeqNo (16)=999999` signified "replay through the latest outbound sequence," whereas FIX 4.2, FIX 4.4, and [FIXT.1.1 / 5.0 SP2](/reports/fixt-1-1-transport-independence-applverid-fix-5-0-sp2-migration) standardize `EndSeqNo (16)=0` as open-ended infinity. Using a specific bounded `16=N` during active traffic creates a classic race condition: by the time the sender finishes replaying up to `N`, live messages `N+1..N+400` were already dropped while out-of-order, provoking a second, third, and fourth `ResendRequest` cascade. Conversely, `16=0` instructs the counterparty to replay the gap and seamlessly transition back to live sequence emission.

![FIX ResendRequest 35=2 gap recovery coalescing skipped orders and heartbeats into SequenceReset-GapFill 35=4](/api/figure?type=flow&title=Coalesced%20SequenceReset-GapFill%20%2835%3D4%2C%20123%3DY%29%20Recovery%20Flow&subtitle=Collapsing%20395%20administrative%20%26%20stale-quote%20sequences%20while%20preserving%20ExecutionReports&steps=1.%20Gap%20Detected%3A%3ARecv%20Seq%20501%20when%20expecting%20105%20-%3E%20Send%2035%3D2%7C2.%20Age%20%26%20Type%20Filter%3A%3ASkip%2035%3D0%2F1%20%26%20stale%2035%3DD%20%28%3E100ms%20old%29%7C3.%20Emit%20GapFill%3A%3A35%3D4%20%20%2034%3D105%20%20%20123%3DY%20%20%2036%3D500%20%20%2043%3DY%7C4.%20Replay%20Fill%20%2B%20Live%3A%3ASend%2035%3D8%20%28Seq%20500%2C%2043%3DY%29%20-%3E%20Resume%20502&metrics=FRAMES%20COLLAPSED%3A%3A395%20-%3E%201%3A%3ASeq%20105..499%20in%20single%2035%3D4%7CSTALE%20ORDER%20TTL%3A%3A100%20ms%3A%3AtoApp%20DoNotSend%20threshold%7CDEBOUNCE%20GUARD%3A%3A2.0x%20RTT%3A%3ABlocks%20duplicate%2035%3D2%20loops%7CHARD%20RESET%20123%3DN%3A%3ABlocked%3A%3ADisallowed%20intraday%20w%2Fo%20Ack)

## GapFill (123=Y) vs Hard SequenceReset-Reset (123=N) Danger Zones

Message type `35=4 (SequenceReset)` operates in two radically different modes controlled by `GapFillFlag (123)`:

- **GapFill Mode (`123=Y`)**: Conformant to normal sequence-stream rules. Its `MsgSeqNum (34)` MUST equal the starting sequence number of the skipped range, `PossDupFlag (43=Y)` and `OrigSendingTime (122)` must be populated, and `NewSeqNo (36)` sets the next expected sequence number *after* the skipped block. If messages `105..499` were heartbeats and cancelled quotes while `500` is an `ExecutionReport (35=8)`, the sender transmits a single `35=4|34=105|43=Y|123=Y|36=500` followed immediately by `35=8|34=500|43=Y`.
- **Reset Mode (`123=N` or omitted)**: Bypasses `MsgSeqNum (34)` validation completely! It forces the receiver's `NextExpectedMsgSeqNum` directly to `NewSeqNo (36)`, silently obliterating any unrecovered fills in between. Production gateways governed by [SEC](/standards/sec) and [FINRA](/standards/finra) audit mandates block inbound `123=N` during intraday trading hours unless manually authorized by operations after cross-checking [out-of-band Drop Copy (35=8)](/reports/drop-copy-execution-report-tag-35-8-oms-reconciliation-architecture).

| Replay Scenario / Message Class | Default Naive QuickFIX Action | Institutional Storm-Safe Action | Wire Sequence Semantics |
| :--- | :--- | :--- | :--- |
| **Admin Frames (`35=0, 1, 2, 4, 5`)** | Never replayed per FIX spec | Coalesced into contiguous `GapFill` | `35=4\|34=M\|123=Y\|36=K\|43=Y` |
| **Stale Outbound `NewOrderSingle (35=D)`** | Re-sent with `43=Y` (**High Risk!**) | Intercepted (`DoNotSend`) -> `GapFill` | Skipped cleanly; prevents toxic late fill |
| **Outbound `OrderCancelRequest (35=F)`** | Re-sent with `43=Y` & `122=...` | Re-sent immediately with `43=Y` | Ensures resting risk is pulled on venue |
| **Venue Outbound `ExecutionReport (35=8)`** | Re-sent verbatim from store | Re-sent verbatim (`43=Y`, `122=Orig`) | Preserves 100% ledger fill completeness |
| **Overlapping `ResendRequest (35=2)`** | Re-triggers full disk replay loop | Debounced within `2 * RTT` window | Eliminates quadratic bandwidth amplification |

## Storm-Control Behavior Across Institutional & Retail Gateway Engines

Different execution stacks handle outbound replay safety very differently—especially regarding whether unacknowledged `NewOrderSingle (35=D)` frames are re-emitted or skipped via `GapFill` to avoid unintended stale fills.

```formula
A_replay = (N_gap * B_avg) / (N_fills * B_fill + N_runs * B_gapfill)
T_drain = (Bytes_transmitted * 8) / BW_session_cap + T_store_seek

Where:
 N_gap = 18,000 total missed sequences (17,958 quotes/heartbeats + 42 fills)
 B_avg = 240 bytes; B_fill = 285 bytes; B_gapfill = 112 bytes; N_runs = 43 GapFill spans
 BW_session_cap = 100 Mbps per-client broker QoS policer (12,500 bytes/ms)
 T_store_seek = 0.09 ms (MMAP offset array) vs 410 ms (unindexed SQL query)

Worked Storm vs Coalesced Comparison:
 Naive Replay Bytes = 18,000 * 240 = 4,320,000 bytes -> T_drain = 345.6 ms + 410 ms = 755.6 ms (x3 storm = 2.27 s)
 Coalesced GapFill Bytes = 42(285) + 43(112) = 11,970 + 4,816 = 16,786 bytes
 T_drain (MMAP + GapFill)= 16,786 / 12,500 + 0.09 ms = 1.43 milliseconds!
 Compression Factor A_replay = 4,320,000 / 16,786 = 257.4x wire volume reduction.
```

## Why Outbound Order Gateways Must Never Blindly Replay Stale 35=D Orders

Consider what happens if an algorithmic strategy sends a 50-lot EUR/USD market sweep (`35=D, 34=812`) at `14:30:00.050` during Non-Farm Payrolls, the TCP packet drops on an intermediate router, and 900 milliseconds later the broker's [cTrader FIX gateway](/platforms/ctrader-terminal-97) or ECN bridge sends `ResendRequest (35=2, 7=812, 16=0)`. A default QuickFIX configuration (`PersistMessages=Y` without an outbound `toApp` age interceptor) automatically pulls `34=812` from disk, stamps `43=Y`, and fires that stale market order into a price 65 pips away!

Institutional execution engines override outbound `toApp` during resend: any `NewOrderSingle (35=D)` or `OrderCancelReplaceRequest (35=G)` whose `SendingTime (52)` exceeds a strict staleness budget (typically `50 ms` to `250 ms`) is suppressed and converted into a `SequenceReset-GapFill (35=4, 123=Y)`, while `OrderCancelRequest (35=F)` frames are allowed through. Pair this rule with [idempotent PossDupFlag=Y (43) deduplication](/reports/possdupflag-tag-43-origsendingtime-tag-122-idempotent-order-dedup) and our [FIX, SBE & OUCH Architecture Guide](/reports/fix-protocol-sbe-ilink3-ouch-session-latency-architecture-guide).

![Socket recovery duration comparing naive frame-by-frame FIX replay against coalesced GapFill and MMAP indexing](/api/figure?type=bars&title=18%2C000-Message%20Sequence%20Gap%20Recovery%20Latency&subtitle=Time%20to%20return%20session%20to%20live%20in-order%20execution%20across%20four%20engine%20designs&steps=SQL%20Disk%20%2B%20Full%20Replay%3A%3A4%2C820%20ms%20%20%20Saturates%20TCP%20send%20buffer%7CFlat%20File%20%2B%20No%20Debounce%3A%3A1%2C190%20ms%20%20%203x%20duplicate%20resend%20storm%7CCoalesced%20GapFill%20%28123%3DY%29%3A%3A38%20ms%20%20%20Replays%20only%2042%20real%20fills%7CMMAP%20Index%20%2B%20GapFill%3A%3A4.1%20ms%20%20%20O%281%29%20offset%20jump%20to%2035%3D8s&metrics=BYTE%20REDUCTION%3A%3A99.4%25%3A%3A42%20fills%20%2B%20GapFill%20vs%2018k%20msgs%7CENDSEQNO%20SPEC%3A%3A16%20%3D%200%3A%3AOpen-ended%20replay%20to%20live%20tip%7COUT-OF-ORDER%20BUF%3A%3A16%2C384%20slots%3A%3ARing%20cache%20avoids%202nd%2035%3D2%7CSLA%20TARGET%3A%3A%3C%2010%20ms%3A%3AInstitutional%20prime%20FIX%20SLA)

## Duplicate ResendRequest Debouncing and Memory-Mapped Replay Indexes

During asymmetric packet loss, a peer may transmit five identical `35=2|7=1040|16=0` requests within 12 milliseconds before the first replay frame arrives across the WAN. Without debouncing, the sender replays messages `1040..3200` five consecutive times, multiplying bandwidth consumption 5x.

Production session state machines maintain a `LastServicedResendRange { beginSeq, highWaterSeq, timestampNs }` guard: if an incoming `ResendRequest` covers a range already transmitted within `2 * smoothed_RTT`, the duplicate request is logged and ignored. Combined with [memory-mapped NVMe sequence offset indexes](/reports/mmap-persistent-fix-sequence-store-nvme-fsync-tail-latency-tuning), gap coalescing scans 100,000 sequence slots in under 90 microseconds—protecting risk limits sized in the [Terminal Margin VaR & ES Calculator](/calculators/terminal-margin-var-es-calculator). See the [FIX, SBE & OUCH Topic Hub](/topics/fix-protocol-sbe-ouch-session-latency) for complete session runbooks.

## Frequently asked questions

### What is the difference between GapFillFlag=Y and GapFillFlag=N in FIX SequenceReset (35=4)?

GapFillFlag=Y (Tag 123) fills a specific sequence gap in response to a ResendRequest (35=2) and must carry the exact expected MsgSeqNum (34) plus PossDupFlag=Y (43). GapFillFlag=N forces an unconditional jump to NewSeqNo (36) while ignoring MsgSeqNum (34), risking permanent data loss if fills were in flight.

### Why should an institutional OMS suppress NewOrderSingle (35=D) during a FIX ResendRequest?

If a network drop prevented an order from reaching the broker, replaying that NewOrderSingle seconds later with PossDupFlag=Y submits a live market or limit order against a completely changed order book. Converting aged orders into GapFill (123=Y) guarantees fail-closed execution safety.

### How does an in-memory out-of-order queue eliminate back-to-back ResendRequest loops?

When Seq 501 arrives while expecting Seq 105, discarding 501..650 while waiting for 105..500 to replay forces a second ResendRequest for 501..650 afterward. Caching 501..650 in a pre-allocated ring buffer lets the engine drain them immediately once replay reaches 500.

### What happens if NewSeqNo (36) in a SequenceReset-GapFill is lower than the current MsgSeqNum (34)?

Lowering sequence numbers violates FIX session monotonicity; the receiving engine must immediately reject the SequenceReset (35=4) with a session-level Reject (35=3, SessionRejectReason=5 Value is incorrect for NewSeqNo) and raise a critical operational alert.


## Source URLs

- https://www.fixtrading.org/standards/fix-session-layer-online/
- https://www.fixtrading.org/standards/fix-4-4/
- https://www.cmegroup.com/confluence/display/EPICSANDBOX/Drop+Copy+4.0

## Citation

- APA: Marcus Thorne, CQF. (2026). FIX ResendRequest (35=2) vs SequenceReset-GapFill (35=4): Preventing Replay Storms. Terminal Ledger Desk. https://terminalledgerdesk.com/reports/fix-resend-request-tag-35-2-sequence-reset-gap-fill-storm-control
- Canonical article: [FIX ResendRequest (35=2) vs SequenceReset-GapFill (35=4): Preventing Replay Storms](https://terminalledgerdesk.com/reports/fix-resend-request-tag-35-2-sequence-reset-gap-fill-storm-control)
- Site research index: [Terminal Ledger Desk](https://terminalledgerdesk.com/llms-full.txt)
