Skip to content
Terminal Ledger Desk
Directory

Fix Protocol Sbe Ouch Session Latency

FIX ResendRequest (35=2) vs SequenceReset-GapFill (35=4): Preventing Replay Storms

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).

By Marcus Thorne, CQFReview not recorded · Updated
FIX ResendRequest (35=2) vs SequenceReset-GapFill (35=4): Preventing Replay Storms — Terminal Ledger Desk 2026 quantitative & supervisory data card
Terminal Ledger Desk (FIX 4.4/5.0 SP2, CME iLink 3 SBE, Nasdaq OUCH/ITCH & Session Recovery): Eliminating quadratic FIX replay storms with GapFill coalescing, stale-order TTLs, and MMAP indexes.Source: Terminal Ledger Desk Institutional Research DeskLicense: CC-BY-4.0

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, 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 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
FIX ResendRequest 35=2 gap recovery coalescing skipped orders and heartbeats into SequenceReset-GapFill 35=4Verified Exhibit

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 and 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).
Quantitative Distribution · Default Naive QuickFIX Action
Default Naive QuickFIX ActionInstitutional Storm-Safe Action
01Stale Outbound NewOrderSing…Re-sent with 43…02Outbound OrderCancelRequest…Re-sent with 43…
Replay Scenario / Message ClassDefault Naive QuickFIX ActionInstitutional Storm-Safe ActionWire Sequence Semantics
Admin Frames (35=0, 1, 2, 4, 5)Never replayed per FIX specCoalesced 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) -> GapFillSkipped cleanly; prevents toxic late fill
Outbound OrderCancelRequest (35=F)Re-sent with 43=Y & 122=...Re-sent immediately with 43=YEnsures resting risk is pulled on venue
Venue Outbound ExecutionReport (35=8)Re-sent verbatim from storeRe-sent verbatim (43=Y, 122=Orig)Preserves 100% ledger fill completeness
Overlapping ResendRequest (35=2)Re-triggers full disk replay loopDebounced within 2 * RTT windowEliminates 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 or model from the articleNot independently verified
A_replay = (N_gap * B_avg) / (N_fills * B_fill + N_runs * B_gapfill)
  • Tdrain = (Bytestransmitted * 8) / BWsessioncap + Tstoreseek
  • Where:
  • N_gap = 18,000 total missed sequences (17,958 quotes/heartbeats + 42 fills)
  • Bavg = 240 bytes; Bfill = 285 bytes; Bgapfill = 112 bytes; Nruns = 43 GapFill spans
  • BWsessioncap = 100 Mbps per-client broker QoS policer (12,500 bytes/ms)
  • Tstoreseek = 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 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 and our FIX, SBE & OUCH Architecture Guide.

Socket recovery duration comparing naive frame-by-frame FIX replay against coalesced GapFill and MMAP indexing
Socket recovery duration comparing naive frame-by-frame FIX replay against coalesced GapFill and MMAP indexingVerified Exhibit

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, gap coalescing scans 100,000 sequence slots in under 90 microseconds—protecting risk limits sized in the Terminal Margin VaR & ES Calculator. See the FIX, SBE & OUCH Topic Hub 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.

Publication record

Published
14 November 2026
Updated
15 November 2026
Author
Marcus Thorne, CQF
Review
Review not recorded
Automated fact check
Passed in the stored pipeline record
Source URLs
3 recorded

AI assistance recorded: anthropic/claude-opus-4.6. This field does not establish human review or source verification.

Academic & Institutional Attribution

Cite This Research & Embed Live Data Card

Open Attribution License (CC BY 4.0)

Standard academic & institutional research paper citation format.

Marcus Thorne, CQF. (2026, November 15). 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
Explore Fix Protocol Sbe Ouch Session Latency Hub (20) →

Terminal Ledger Desk Data, Benchmarks & Contributor Records

FIX ResendRequest (35=2) & GapFill (35=4) Storm Control | Terminal Ledger Desk