fix(yip-io): make io_uring loopback recycle tests robust on default rmem#113
Merged
Conversation
Both `uring_loopback_roundtrip_recycles_recv_buffers` and `uring_in_flight_send_table_reuses_slots_after_completions` blasted all datagrams into the socket before draining, then asserted more than 256 (RING_BUFS / SEND_SLOTS) round-trip. That requires the kernel to buffer >256 datagrams at once, but the default net.core.rmem_default (~208 KB) only holds ~230 small datagrams (per-skb truesize overhead), so the assert failed deterministically on stock-configured boxes (got 237, needed >256). Interleave send and drain with a bounded in-flight window (64) so nothing is dropped and both counts reach `total` on any box. Recycling of the fixed pool is still proven — far more than the pool size flows *through* it — and a real leak still stalls at <= pool size and fails. Bonus: no more stall-spinning, so the tests drop from ~4.6 s to ~0.2 s.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two io_uring tests fail deterministically on any box with a default UDP receive buffer:
uring_loopback_roundtrip_recycles_recv_buffersuring_in_flight_send_table_reuses_slots_after_completionsBoth blasted all datagrams into the socket before draining, then asserted more than 256 (
RING_BUFS/SEND_SLOTS) round-trip. That requires the kernel to buffer >256 datagrams at once, but the defaultnet.core.rmem_default(~208 KB) only holds ~230 small datagrams (per-skb truesize overhead). Result on a stock box:got 237, needed >256→ fail. It only passed where rmem was tuned up.Fix
Interleave send and drain with a bounded in-flight window (64), so the kernel receive buffer never has to hold more than 64 at once. Nothing is dropped, both counts reach
totalon any box.The test's intent is preserved: recycling of the fixed pool is still proven by round-tripping far more than the pool size through it, and a genuine leak still stalls at ≤ pool size and fails both asserts.
Verify
rmem_default = 212992.cargo testworkspace suite passes (pre-commit hook).