fix(trafficgen): interleave flows per pass so saturation can't starve benign #258
No reviewers
Labels
No labels
bug
deploy
documentation
duplicate
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
femboy/blackwall!258
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/trafficgen-fair-interleave"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The trafficgen
verifygate (gate 3) failed once the iface fix (#256) let it run for the first time:Root cause — a real generator bug, exposed (not caused) by CI slowness. The paced send loop drained each flow's whole per-pass
duein spec order — udp 50k → syn 20k → refl 5k → malformed 1k → benign 1k pps — before moving to the next flow. When the tx ring saturates andsendtoreturns ENOBUFS (silently dropped:if res.is_ok()), the high-rate flows at the front fill the ring and every flow after them eats the drops. Received fractions from the failing run show it exactly:The gate checks benign's proportional share; its premise ("received counts are proportional to pps") is false under saturation because the service order is priority-by-list-position, not fair. On a fast dev box the loop hits 77k pps → no saturation → passed, which is why this never surfaced until the gate first completed in CI.
Fix. Emit round-robin across flows — one frame per flow per cycle, via a pure
interleave_order(dues) -> Vec<usize>helper — instead of draining each flow's full due in order. ENOBUFS drops then distribute in proportion to each flow's due, so no flow (notably benign, last in the spec) is starved below its share, at any runner speed. Total frame count and per-flow due are unchanged; only emission order differs.Verified.
cargo test -p blackwall-trafficgengreen incl. 3 newinterleave_ordertests (round-robin order, per-flow/total count preservation, empty). clippy--deny warnings+ fmt clean. The trafficgen lab gate on this PR is the real end-to-end check.