Skip to content

fix(quic): ignore empty UDP datagrams in endpoint - #1070

Merged
Berrysoft merged 1 commit into
compio-rs:masterfrom
amandeavor:fix/quic-empty-udp-packet
Oct 10, 2026
Merged

Berrysoft merged 1 commit into
compio-rs:masterfrom
amandeavor:fix/quic-empty-udp-packet

Conversation

@amandeavor

Copy link
Copy Markdown
Contributor

Problem

Receiving an empty UDP datagram panics the endpoint worker:

thread 'main' panicked at compio-quic/src/endpoint.rs:65:14:
chunk size must be non-zero

handle_data calls buf[..meta.len].chunks(meta.stride.min(meta.len)). When meta.len == 0 (empty UDP payload), that becomes chunks(0), which panics. Reproduced by sending UdpSocket::send_to([], server_addr) at a running endpoint (see #1069).

Solution

Return early from handle_data when meta.len == 0. Empty UDP datagrams are not valid QUIC packets, so there is nothing to process. This matches quinn's approach of skipping empty datagram buffers (while !data.is_empty()).

Test

Added empty_udp_packet_does_not_panic in compio-quic/tests/basic.rs: send an empty UDP packet to a server endpoint, then complete a normal handshake to confirm the worker is still alive.

cargo test -p compio --features all --package compio-quic --test basic

Fixes #1069

Empty UDP packets caused `buf.chunks(0)` to panic with "chunk size must
be non-zero". Skip zero-length payloads before chunking, matching how
quinn skips empty datagrams.

Fixes compio-rs#1069
Copilot AI lite review requested due to automatic review settings September 25, 2026 07:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added bug Something isn't working package: quic Related to compio-quic labels Sep 25, 2026

@Berrysoft Berrysoft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. But seems created by LLM, and the author doesn't answer the questions.

@Berrysoft
Berrysoft merged commit 552c420 into compio-rs:master Oct 10, 2026
90 checks passed
@amandeavor
amandeavor deleted the fix/quic-empty-udp-packet branch October 10, 2026 14:39
@amandeavor

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing and merging, @Berrysoft! I appreciate the catch and review. To clarify, I use AI tooling in my workflow alongside local test reproduction and manual inspection. I'll make sure to monitor and respond to any questions much more promptly going forward.

@github-actions github-actions Bot mentioned this pull request Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working package: quic Related to compio-quic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QUIC endpoint may panic when receiving an empty UDP packet

3 participants