Skip to content

Don't shut down WireGuard and UDP servers when a send fails with ENOBUFS - #341

Open
Photonios wants to merge 1 commit into
mitmproxy:mainfrom
Photonios:wireguard-survive-enobufs
Open

Photonios wants to merge 1 commit into
mitmproxy:mainfrom
Photonios:wireguard-survive-enobufs

Conversation

@Photonios

Copy link
Copy Markdown

On macOS, send_to() on a UDP socket can fail with ENOBUFS ("No buffer space available", os error 55) when there is a burst of traffic, instead of blocking. The WireGuard server passed this error up with ?, so one dropped datagram stopped the whole WireGuard task (Task failed: No buffer space available (os error 55)) and every client lost its connection. The UDP server had the same problem.

The error is temporary and UDP is lossy anyway, so now we log the datagram at debug level and drop it. TCP inside the tunnel retransmits it. Other send errors still fail the task like before.

@Photonios
Photonios marked this pull request as ready for review November 29, 2026 06:15

This branch has not been deployed

No deployments
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