Pairing two captured event streams by index silently shifts every pair after one lost event
Symptom#
An analysis pairs the Nth event of one stream with the Nth event of another (the Nth send with the Nth receive on an in-order queue, say). Some pairs give impossible results, such as a receive stamped before its send. The analysis prints a note that the counts differ, such as 10000 sends, 9811 receives, but still reports numbers for that queue.
Cause#
In-order delivery makes "Nth with Nth" correct only when both streams are complete. When the capture loses one event, every later pair is off by one, and nothing in the data says where the loss was. Pairing "the shorter length from the start" does not fix it: the loss can be anywhere, not only at the end.
Fix#
- When the two counts differ, leave that stream pair out and report it. Do not pair it.
- Pair by a sequence number carried in the data (an immediate, a message id) when one exists.
- Before trusting an anomaly (negative legs, a jump), check that both streams of the affected pair have equal counts.
Evidence#
In dpucrumbs dpucrumbs/analysis/asynchrony.py, legs() paired by index even when counts differed. In run lat_doca/20260929-085007 one reader lost 1.7 to 1.9 percent of completions on every queue pair, so the blocks of negative legs seen there could not be separated from pairing shifts. After the fix (commit 1d09c2f) the tool prints qp ...: 10000 sends, 9811 receives, left out. The run with equal counts, lat_doca/20260929-135823, gave the same -1.33 / -1.16 us as before.
Also found by searching
- 10000 sends, 9811 receives
- impossible negative latency after pairing events by index
- how do I pair send and receive completions when some were lost
- Nth send matched to Nth receive goes off by one
- 10000 sends, 9811 receives but latency analysis still reports negative values
- matching send and receive events gives receive timestamps before sends
- how do I pair send and receive trace events when some events were dropped
- zip two event lists by position misaligned after lost record, need ids to match