# FIX Heartbeat (35=0), TestRequest & TCP Dead-Peer Tuning

> Calibrate FIX HeartBtInt (Tag 108), TestRequest (35=1 / Tag 112) RTT thresholds, and Linux TCP_USER_TIMEOUT socket options to detect silent firewall drops fast.

Canonical: https://terminalledgerdesk.com/reports/fix-heartbeat-tag-35-0-testrequest-tag-35-1-half-open-tcp-detection
Last updated: 2026-11-16T06:21:48.029Z

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

## Answer-first summary

Default 30-second FIX HeartBtInt (Tag 108) timers leave algorithmic gateways blind to silent NAT/firewall blackholes for up to 36 seconds unless paired with tight TestRequest (35=1) grace intervals and Linux TCP_USER_TIMEOUT.

## Key takeaways

- Combining Linux TCP_USER_TIMEOUT=500ms with tuned FIX HeartBtInt=5 cuts active-order blackhole detection from 66 seconds down to 500 milliseconds.
- TCP_USER_TIMEOUT catches physical link drops during outbound transmission, while FIX TestRequest (35=1) catches deadlocked peer processes whose OS kernel still ACKs TCP.
- Always validate that the inbound Heartbeat (35=0) echoes the exact TestReqID (Tag 112) string rather than accepting an older in-flight unsolicited heartbeat.
- Decouple socket RX byte-arrival timestamping from application parsing threads so local CPU bursts never trigger false TestRequest disconnects.

## Related financial entities

- **Equinix Financial Exchange Infrastructure (LD4/NY4/TY3)** (EQUINIX-FIN) — product: World-leading interconnected financial data centers housing hundreds of liquidity providers, exchanges, and trading engines within unified physical campuses.
- **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

Not all network outages graciously transmit a TCP `FIN` or `RST` packet: stateful firewall failovers, fiber optic attenuation bends, and asymmetric cloud router blackholes leave sockets **half-open**, swallowing outbound `NewOrderSingle (35=D)` frames into kernel retransmission queues with zero immediate error return from `send`. Relying on default OS `tcp_retries2 = 15` (`~13 minutes`) or sluggish `HeartBtInt = 30` (`Tag 108`) defaults exposes trading desks to 36+ seconds of unacknowledged blind risk unless session timers and Linux `TCP_USER_TIMEOUT` sockets are co-engineered.

## Exact State Machine of HeartBtInt (108), Heartbeat (35=0) & TestRequest (35=1)

During `Logon (35=A)`, initiator and acceptor agree on `HeartBtInt (Tag 108)` in seconds. Under the [FIX session layer specification](/engines/fix-session-layer-specification), two independent timers govern liveness:

- **Outbound Idle Timer (`1.0 * HeartBtInt`)**: Reset every time *any* application or admin packet is written to the socket. Only if `HeartBtInt` elapses with zero outbound traffic does the engine emit an unsolicited `Heartbeat (35=0)` (with no `TestReqID`).
- **Inbound Silence Timer (`HeartBtInt + Grace_Transmission`)**: Reset every time *any* valid FIX frame arrives from the peer. When `HeartBtInt + Grace` expires with zero inbound bytes, the engine does **not** disconnect immediately; instead, it transmits `TestRequest (35=1)` carrying a unique `TestReqID (Tag 112)` (typically a microsecond UTC counter). The peer MUST echo a `Heartbeat (35=0)` copying that exact `TestReqID (112)`. If a second grace window expires without matching `112`, the engine declares the peer dead, closes the socket, and triggers [high-availability failover](/engines/ha-trading-failover-architecture).

![Dual-layer dead-peer detection combining Linux TCP_USER_TIMEOUT 500ms ACK checks with FIX TestRequest 35=1](/api/figure?type=flow&title=Two-Layer%20Blackhole%20Detection%3A%20Kernel%20TCP%20%2B%20FIX%2035%3D1&subtitle=Catching%20active-order%20drops%20in%20500%20ms%20and%20idle-session%20blackholes%20in%206.5%20s&steps=1.%20Active%20TX%20Guard%3A%3ATCP_USER_TIMEOUT%3D500ms%20checks%20TCP%20ACK%7C2.%20Idle%20Silence%3A%3AHeartBtInt%3D5s%20%2B%200.5s%20-%3E%20Emit%2035%3D1%20%28112%3DID%29%7C3.%20Echo%20Verify%3A%3AAwait%2035%3D0%20w%2F%20matching%20Tag%20112%20in%201.0s%7C4.%20Failover%20%26%20COD%3A%3AClose%20socket%20-%3E%20Backup%20port%20%2B%20DropCopy%20check&metrics=ACTIVE%20DROP%20SLA%3A%3A500%20ms%3A%3AVia%20TCP_USER_TIMEOUT%20kernel%7CIDLE%20DROP%20SLA%3A%3A6.5%20sec%3A%3A108%3D5%20%2B%200.5s%20%2B%201.0s%2035%3D1%7CLINUX%20DEFAULT%3A%3A~924%20sec%3A%3AUn-tuned%20tcp_retries2%3D15!%7CFALSE%20TRIP%20RATE%3A%3A0.00%25%3A%3ARX%20thread%20timestamp%20decouple)

## Why Naive `2.0 * HeartBtInt` Grace Windows Are Dangerous on 10GbE Links

Legacy 1990s dial-up guidance suggested setting the `TestRequest` transmission grace window to `20%` to `100%` of `HeartBtInt`. With `108=30`, waiting `30s + 6s` to send `35=1` and another `30s` for the reply means **66 seconds** of dead-peer blindness! On modern [Equinix colocation cross-connects](/engines/equinix-financial-infrastructure) where physical RTT is `0.15 ms` (or cross-continental London-to-Tokyo WAN at `165 ms`), institutional venues negotiate `108=5` or `108=10` (and `KeepAliveInterval=5000 ms` on [CME iLink 3 SBE](/reports/cme-ilink-3-sbe-uuid-session-negotiation-establish-state-machine)) while tightening post-`TestRequest` timeout to `max(1500 ms, 4 * SRTT)`.

Simultaneously, beware of **head-of-line blocking false disconnects**: if your own parser stalls for 4 seconds processing an uncoalesced [ResendRequest replay storm](/reports/fix-resend-request-tag-35-2-sequence-reset-gap-fill-storm-control), inbound `35=0` frames sit unread inside the kernel TCP receive buffer! Always read kernel RX timestamps (`SO_TIMESTAMPNS`) or update `lastInboundByteNs` in the network reader thread before declaring a peer dead.

| Liveness Mechanism | Protocol / OS Layer | Typical Production Setting |Worst-Case Detection Time | Failure Mode Caught |
| :--- | :--- | :--- | :--- | :--- |
| **Linux `tcp_retries2=15` (Default)** | OS Kernel TCP | Unconfigured default | ~13 to 15 minutes | Catastrophically slow on WAN blackholes |
| **Linux `TCP_USER_TIMEOUT`** ([FIX API](/software/fix-api)) | OS Kernel TCP (`setsockopt`) | `500 ms` (Colo) / `2,000 ms` (WAN) | 0.50 s – 2.00 s | Any un-ACKed outbound order/cancel in flight |
| **FIX `HeartBtInt` + `TestRequest`** ([FIXT](/engines/fix-session-layer-specification)) | Session Layer (`35=0` / `35=1`) | `108=5`, Grace `0.5s`, Reply `1.0s` | 6.50 s | Hung peer daemon (TCP stack still ACKing!) |
| **SoupBinTCP Heartbeat** (Nasdaq OUCH) | Binary Session Framing | Fixed `1,000 ms` (`R` / `H`) | 2.00 s – 3.00 s | Both silent drop & frozen gateway process |

## Dead-Peer Detection SLA Across Socket & Session Layers

Coordinating kernel TCP retransmission timeouts with FIX `35=1` probes cuts blackhole detection time by an order of magnitude across institutional and broker platforms like [ActivTrader](/platforms/activtrader-terminal-21) and [IG DMA](/platforms/ig-trading-cfds-stocks-terminal-9).

```formula
T_detect_idle = HeartBtInt + T_grace_send_35_1 + T_await_112_reply
T_detect_active = min( T_detect_idle, TCP_USER_TIMEOUT_ms / 1000 )
Drift_sigma_99 = 2.326 * Sigma_1s * sqrt( T_detect ) * Notional_open

Where:
 Sigma_1s = 0.00018 (1.8 bps per sqrt-second during FOMC volatility)
 Notional_open = $25,000,000 unhedged resting quote inventory
 T_stock = 66.0 s (un-tuned 108=30); T_tuned = 0.50 s (TCP_USER_TIMEOUT=500ms)

Worked 99% Unhedged Price-Drift Exposure Reduction:
 Drift_99 (Stock 66s) = 2.326 * 0.00018 * sqrt(66.0) * $25M = $84,992 tail exposure!
 Drift_99 (Tuned 0.5s) = 2.326 * 0.00018 * sqrt(0.50) * $25M = $7,401 tail exposure (-91.3% risk reduction).
```

## Coupling Linux `TCP_USER_TIMEOUT` With Outbound Unacknowledged Bytes

Observe a critical blind spot of FIX `HeartBtInt=10`: if a link blackholes at `t = 0.1s` right after an inbound market tick, `HeartBtInt` will not even *notice* silence until `t = 10.1s`—yet your strategy may have transmitted an urgent `OrderCancelRequest (35=F)` at `t = 0.2s` whose TCP segment is sitting un-ACKed in the Linux retransmission buffer!

Setting `setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &ms, sizeof(ms))` (`ms = 2000` on WAN, `ms = 500` on metro fiber) instructs the Linux kernel to abort the socket with `ETIMEDOUT` the instant **any transmitted TCP data remains unacknowledged by the peer TCP stack for 500 ms**! Combined with `TCP_NODELAY` (see [TCP Nagle and delayed-ACK jitter](/reports/tcp-nagle-nodelay-delayed-ack-interaction-fix-order-gateway-jitter)), active order traffic detects silent fiber cuts in **500 milliseconds** rather than waiting 12 seconds for `HeartBtInt`.

![Blackhole detection latency across Linux default TCP, 30s QuickFIX default, tuned 5s HeartBtInt, and TCP_USER_TIMEOUT](/api/figure?type=bars&title=Silent%20Blackhole%20Detection%20Time%20by%20Configuration&subtitle=Elapsed%20milliseconds%20from%20physical%20fiber%20cut%20to%20deterministic%20OMS%20failover&steps=Stock%20QuickFIX%20%28108%3D30%29%3A%3A66%2C000%20ms%20%20%2030s%20%2B%206s%20%2B%2030s%20wait%7CStandard%20Broker%20%28108%3D15%29%3A%3A18%2C500%20ms%20%20%2015s%20%2B%201.5s%20%2B%202.0s%7CColo%20Tuned%20Idle%20%28108%3D5%29%3A%3A6%2C500%20ms%20%20%20Tight%201.0s%20TestReq%20SLA%7CActive%20TX%20%2B%20USER_TIMEOUT%3A%3A500%20ms%20%20%20Un-ACKed%20order%20tripwire&metrics=DETECTION%20GAIN%3A%3A132x%3A%3A500%20ms%20vs%2066%2C000%20ms%20stock%7CTESTREQID%20MATCH%3A%3AExact%20Str%3A%3ATag%20112%20anti-stale-echo%20check%7CSOUPBINTCP%20ALT%3A%3A1%2C000%20ms%3A%3ANasdaq%20OUCH%201s%20heartbeat%7CILINK%203%20MIN%3A%3A5%2C000%20ms%3A%3ACME%20KeepAliveInterval%20floor)

## Coordinating Dead-Peer Timeouts With Venue Cancel-On-Disconnect (COD)

Whenever an execution gateway severs a blackholed socket, its local timeout MUST align with the exchange-side Cancel-On-Disconnect grace timer under [SEC](/standards/sec) and [FCA](/standards/fca) controls (synthesized in our [FIX, SBE & OUCH Session Architecture Guide](/reports/fix-protocol-sbe-ilink3-ouch-session-latency-architecture-guide)):

- If client dead-peer failover switches to Backup Port B at `1.5s` while Primary Port A has a `5.0s` COD grace timer, Backup Port B must query open orders or wait/force port purge so resting quotes on Port A are not orphaned or double-quoted.
- Model worst-case unhedged price drift during that `0.5s–5.0s` detection window inside the [Terminal Margin VaR & ES Calculator](/calculators/terminal-margin-var-es-calculator) and review additional session runbooks in the [FIX, SBE & OUCH Topic Hub](/topics/fix-protocol-sbe-ouch-session-latency).

## Frequently asked questions

### Why is TCP Keepalive alone insufficient to replace FIX Heartbeat (35=0) and TestRequest (35=1)?

Kernel TCP Keepalives are handled entirely inside the remote OS network stack! If the remote broker Java/C++ FIX gateway deadlocks in garbage collection or an infinite loop, the remote Linux kernel continues answering TCP Keepalives while zero orders are processed—only FIX 35=1 proves application liveness.

### Can Initiator and Acceptor use different HeartBtInt (Tag 108) values on the same FIX session?

No. Under the FIX session standard, the Initiator proposes HeartBtInt (Tag 108) in its Logon (35=A) and the Acceptor echoes the agreed value back. Both sides must drive their outbound and inbound timers from that single symmetric interval.

### What happens if an engine receives a TestRequest (35=1) while in the middle of a sequence gap?

Provided MsgSeqNum (34) is valid or queued per session policy, responding promptly with Heartbeat (35=0) carrying the requested TestReqID (112) prevents the peer from severing the TCP socket mid-recovery while ResendRequest (35=2) drains.

### What is the lowest HeartBtInt value supported by institutional exchanges and prime brokers?

Most ASCII FIX 4.4/5.0 prime-broker gateways allow HeartBtInt down to 5 or 10 seconds (rejecting 108=1 to limit admin log noise), whereas binary protocols like Nasdaq SoupBinTCP run native 1-second heartbeats and CME iLink 3 supports 5,000 ms KeepAliveInterval.


## Source URLs

- https://www.fixtrading.org/standards/fix-session-layer-online/
- https://datatracker.ietf.org/doc/html/rfc793
- https://www.cmegroup.com/confluence/display/EPICSANDBOX/Cancel+on+Disconnect

## Citation

- APA: Marcus Thorne, CQF. (2026). FIX Heartbeat (35=0), TestRequest (35=1) & Linux TCP_USER_TIMEOUT Dead-Peer Detection. Terminal Ledger Desk. https://terminalledgerdesk.com/reports/fix-heartbeat-tag-35-0-testrequest-tag-35-1-half-open-tcp-detection
- Canonical article: [FIX Heartbeat (35=0), TestRequest (35=1) & Linux TCP_USER_TIMEOUT Dead-Peer Detection](https://terminalledgerdesk.com/reports/fix-heartbeat-tag-35-0-testrequest-tag-35-1-half-open-tcp-detection)
- Site research index: [Terminal Ledger Desk](https://terminalledgerdesk.com/llms-full.txt)
