Tail-drop UDP datagrams on receive-queue overflow#859
Open
brandonpayton wants to merge 1 commit into
Open
Conversation
When a UDP socket's receive queue is full, Linux drops the incoming datagram (SO_RCVBUF overflow) and preserves already-queued data. Kandelo instead evicted the OLDEST queued datagram (`dgram_queue.remove(0)`) to make room, producing head-loss and reordering that UDP applications — which expect tail-loss — do not anticipate. Drop the incoming datagram when the queue is at `UDP_DATAGRAM_QUEUE_LIMIT`. No ABI change. Validation: `cargo test -p kandelo --lib` (964 pass, incl. new `test_udp_recv_queue_tail_drops_on_overflow`: send LIMIT+2 sequence-numbered datagrams to a loopback socket, drain, assert the surviving datagrams are the oldest 0..LIMIT in order). `scripts/check-abi-version.sh` in sync. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 10, 2026
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.
Contract: UDP overflow drops the incoming datagram, not the oldest
When a UDP socket's receive queue is full, Linux (SO_RCVBUF overflow) drops the incoming datagram and preserves already-queued data. Kandelo evicted the oldest queued datagram (
dgram_queue.remove(0)) to make room, producing head-loss and reordering that UDP applications — which expect tail-loss — do not anticipate.Fix
Drop the incoming datagram when the queue is at
UDP_DATAGRAM_QUEUE_LIMIT.ABI
No change.
Validation
cargo test -p kandelo --target aarch64-apple-darwin --lib— 964 pass, including newtest_udp_recv_queue_tail_drops_on_overflow: sendLIMIT+2sequence-numbered datagrams to a loopback socket, drain, assert the survivors are the oldest0..LIMITin order (before the fix,remove(0)would leave2..LIMIT+1).scripts/check-abi-version.sh— snapshot in sync.🤖 Generated with Claude Code