Loss detection is an inference from incomplete evidence
Compute an illustrative TCP retransmission estimate, handle retransmitted-sample ambiguity, and distinguish duplicate-ACK recovery from timer expiry and QUIC probes.
On this page
The question for today
What you’ll understand
- Update smoothed RTT and variation in the correct order.
- Explain why an acknowledgment after retransmission can produce an ambiguous sample.
- Distinguish evidence of reordering, inferred loss, timer expiration, and connection failure.
A sender cannot watch a packet disappear. It observes acknowledgments, elapsed time, and sometimes explicit feedback, then chooses when waiting has become more costly than retransmitting. A short timer repairs genuine loss sooner but risks treating a delayed packet as lost. A long timer avoids some false alarms while delaying recovery. Good analysis preserves that uncertainty instead of interpreting every retransmission as proof that the original transmission was dropped.
Estimate delay and variation separately
An RTT sample spans a transmission and the acknowledgment used to time it. It includes forward travel, receiver behavior such as delayed acknowledgment, reverse travel, and relevant endpoint scheduling. It is not a one-way propagation measurement. RFC 6298 maintains a smoothed RTT and an estimate of variation, adding a safety margin when computing a retransmission timeout. The smoothing makes the timer less sensitive to one observation, while the variation term gives unstable observations a different effect from consistently high delay. Retain clock granularity and configured limits when reproducing an implementation's decision.
For a subsequent eligible sample, update variation using the old smoothed RTT, then update the smoothed RTT itself. Reversing that order makes the apparent deviation artificially smaller. The conventional coefficients are one eighth for the mean and one quarter for variation. An estimator expression is not yet the effective timer: RFC 6298 recommends rounding computed values below one second up to one second, and allows other conservative choices within its rules. Actual stacks may apply documented alternatives. Label a worked estimate as a specification calculation rather than a universal observed timeout.
Do not time the wrong transmission
Suppose bytes are sent at time zero and retransmitted at 0.8 seconds; an ACK arrives at 0.9 seconds. Without distinguishing information, did the original take 0.9 seconds or the retransmission take 0.1 seconds? Feeding the shorter possibility into the estimator can encourage more premature retransmission. Karn's rule avoids ambiguous RTT samples from retransmitted data unless a mechanism such as TCP timestamps resolves which transmission was acknowledged. A capture can still show both elapsed intervals, but the existence of numbers does not make either one a defensible RTT sample.
When a retransmission timer expires, TCP retransmits under its recovery rules and backs off the timer exponentially. Backoff reduces repeated pressure while feedback is missing; it does not diagnose whether the cause is congestion, a failed link, receiver overload, or filtering. An application's deadline can expire before the transport concludes the connection is unusable. Conversely, abandoning application work does not automatically cancel bytes already sent. Keep separate timestamps for the business deadline, socket closure, timer expiration, and retry attempt so a dashboard does not collapse four different events into a single timeout category.
Use additional acknowledgments without pretending they are omniscient
Later arrivals can generate duplicate cumulative ACKs when an earlier range is absent. Classic TCP fast retransmit uses three duplicate ACKs as a loss signal, allowing recovery before the retransmission timer in suitable traces. Reordering can produce a similar pattern, and short flights may not generate enough later ACKs to trigger it. Modern recovery can use selective acknowledgments and additional time-based logic. Always name the actual algorithm when interpreting a trace. QUIC also has packet- and time-threshold loss detection; its probe timeout sends probes to obtain feedback and is not itself a declaration that every outstanding packet was lost.
The probability lab isolates one reason sparse feedback is possible. Let a trial be a hypothetical later segment's successful independent arrival; change delivery probability and the number of later segments. Predict the chance of zero successful later arrivals by reading the zero-success bar. This is not a duplicate-ACK counter: delayed ACK policies, loss correlation, receiver behavior, and retransmission rules are absent. Use the result to question whether enough evidence can arrive quickly, then return to an actual capture and sender state before deciding which recovery path should have run.
Work it through
Compute an estimate without forgetting the timer floor
Before a valid sample, S=0.200 seconds and V=0.040 seconds. The new sample is R=0.240 seconds and clock granularity G=0.001 seconds. Use RFC 6298's conventional coefficients.
Use the old mean for deviation: |0.200−0.240|=0.040 seconds. Thus V'=0.75×0.040+0.25×0.040=0.040 seconds.
Update the mean: S'=0.875×0.200+0.125×0.240=0.205 seconds. The raw estimate is 0.205+max(0.001,0.160)=0.365 seconds.
Applying the RFC's recommended one-second minimum yields a one-second timer for this illustration. A measured stack using another documented policy needs its own configuration and recovery-state evidence.
The raw estimator is 365 milliseconds, while the illustrated effective minimum is one second. Neither number proves that any particular packet is lost.
The living notebook
Explore the model
Interactive lab · probability
Will later data provide feedback?
Set p as a hypothetical later segment's independent delivery chance and n as the number of later segments. Inspect zero successful arrivals. This binomial illustration does not generate ACKs, update RTT estimators, detect reordering, or run TCP/QUIC recovery.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA small flight can provide little loss evidence; recovery behavior depends on feedback opportunities as well as elapsed time.
Pause & reason
Check your understanding
Your turn
Try it yourself
An illustrative retransmission timer begins at one second and doubles after each expiry. Ignoring caps and new samples, list the next three timer durations and their combined waiting time.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Distinguish the duration of each new timer from cumulative elapsed time, and start doubling after the original expires.
Compare with the solution
After the original one-second expiry, the next three durations are two, four, and eight seconds. These three waits total fourteen seconds; including the original wait gives fifteen seconds. They are backoff intervals, not measurements of the path RTT and not a guaranteed application deadline.
Keep the idea
Take it with you
- RTT estimation must preserve sample eligibility and update ordering.
- A retransmission can follow inferred loss, reordering, or missing feedback.
- Transport timers, probe timers, and application deadlines answer different questions.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.