Skip to content

Tail-drop UDP datagrams on receive-queue overflow#859

Open
brandonpayton wants to merge 1 commit into
mainfrom
fix/udp-queue-tail-drop
Open

Tail-drop UDP datagrams on receive-queue overflow#859
brandonpayton wants to merge 1 commit into
mainfrom
fix/udp-queue-tail-drop

Conversation

@brandonpayton

Copy link
Copy Markdown
Member

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 --lib964 pass, including new test_udp_recv_queue_tail_drops_on_overflow: send LIMIT+2 sequence-numbered datagrams to a loopback socket, drain, assert the survivors are the oldest 0..LIMIT in order (before the fix, remove(0) would leave 2..LIMIT+1).
  • scripts/check-abi-version.sh — snapshot in sync.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant