[PR #1696] [MERGED] Drop UDP packets on send failure #2528

Closed
opened 2026-03-16 10:06:11 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1696
Author: @jeff-hiner
Created: 4/15/2022
Status: Merged
Merged: 4/19/2022
Merged by: @bluejekyll

Base: mainHead: fix_udp_send


📝 Commits (1)

  • d45738f Drop UDP packets on send failure

📊 Changes

2 files changed (+9 additions, -2 deletions)

View changed files

📝 crates/proto/src/udp/udp_stream.rs (+8 -1)
📝 crates/server/src/server/server_future.rs (+1 -1)

📄 Description

Two fixes here:

  • If the sending a UDP response fails, the packet is left in the buffer and retried on the next iteration. Unfortunately, some send errors aren't recoverable: a route becoming invalid will cause trust-dns-server to tight loop forever while it tries to send before receiving. I can pretty reliably reproduce this on Windows 10 by running a proxying server and putting the machine into Modern Standby. The simple fix is to drop the UDP packet if sending returns an error.
  • If the recv half actually does fail, the stream will never return None. Most errors on recv aren't recoverable and shouldn't be retried-- the interface to which the server is attached getting deleted is one common case. Because UdpStream::poll_next never returns Poll::Ready(None), the server will never terminate on errors. Ideally we would fuse UdpStream by returning Some(Err) once, then None thereafter to indicate the stream is permanently unusable. But for now, breaking on error fixes the immediate problem.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/1696 **Author:** [@jeff-hiner](https://github.com/jeff-hiner) **Created:** 4/15/2022 **Status:** ✅ Merged **Merged:** 4/19/2022 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `fix_udp_send` --- ### 📝 Commits (1) - [`d45738f`](https://github.com/hickory-dns/hickory-dns/commit/d45738fece84336174ac3521a2994471820ca289) Drop UDP packets on send failure ### 📊 Changes **2 files changed** (+9 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/proto/src/udp/udp_stream.rs` (+8 -1) 📝 `crates/server/src/server/server_future.rs` (+1 -1) </details> ### 📄 Description Two fixes here: * If the sending a UDP response fails, the packet is left in the buffer and retried on the next iteration. Unfortunately, some send errors aren't recoverable: a route becoming invalid will cause trust-dns-server to tight loop forever while it tries to send before receiving. I can pretty reliably reproduce this on Windows 10 by running a proxying server and putting the machine into Modern Standby. The simple fix is to drop the UDP packet if sending returns an error. * If the recv half actually does fail, the stream will never return None. Most errors on recv aren't recoverable and shouldn't be retried-- the interface to which the server is attached getting deleted is one common case. Because `UdpStream::poll_next` never returns `Poll::Ready(None)`, the server will never terminate on errors. Ideally we would fuse UdpStream by returning Some(Err) once, then None thereafter to indicate the stream is permanently unusable. But for now, breaking on error fixes the immediate problem. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 10:06:11 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#2528
No description provided.