Repository navigation
wgengine/magicsock,health: retry all UDP read errors with a delay - #22183
Merged
Merged
Conversation
illotum
requested changes
Nov 5, 2026
nbeirne
force-pushed
the
nbeirne/handle-read-errors
branch
3 times, most recently
from
November 5, 2026 20:51
1a357bd to
6f68bfd
Compare
illotum
approved these changes
Nov 5, 2026
illotum
left a comment
Contributor
There was a problem hiding this comment.
LGTM with a couple minor comments.
| Syscall: "recvfrom", Err: tt.err, | ||
| }} | ||
| pconn := &scriptedPacketConn{} | ||
| for range 12 { |
Contributor
There was a problem hiding this comment.
nonblocking,nit: this doesn't have to be 12 anymore. wg-go's death spiral counter is no longer a thing.
Contributor
There was a problem hiding this comment.
nit: Looks like it's back? :)
nbeirne
force-pushed
the
nbeirne/handle-read-errors
branch
from
November 6, 2026 14:17
6f68bfd to
f7faea5
Compare
nbeirne
force-pushed
the
nbeirne/handle-read-errors
branch
from
November 6, 2026 20:47
f7faea5 to
e4d1f51
Compare
Contributor
Author
|
Not merging until we fix another issue. This will need a rebase. |
nbeirne
force-pushed
the
nbeirne/handle-read-errors
branch
3 times, most recently
from
November 10, 2026 14:41
66538e4 to
128b5c9
Compare
nbeirne
commented
Nov 10, 2026
illotum
reviewed
Nov 12, 2026
| Syscall: "recvfrom", Err: tt.err, | ||
| }} | ||
| pconn := &scriptedPacketConn{} | ||
| for range 12 { |
Contributor
There was a problem hiding this comment.
nit: Looks like it's back? :)
tailscale/wireguard-go#116 changed the receive loop to retry any errors other than net.ErrClosed without a delay. magicsock entered a spin loop if it encountered a UDP read error. magicsock's receive funcs now return only net.ErrClosed when the socket actually closes. Every other read error is counted, logged, and retried after a short delay. IsUDPReadFeedback and IsUDPReadUnknown are removed because they can be handled like any other error. Retrying errors may hide failures which used to stop the receive func. - There is a new metric magicsock_recv_udp_error which counts all read errors. - After 30s of continuous errors, the receive function marks itself as broken. A warning is raised until a read succeeds. Updates #22097 Change-Id: Ib9ade0ed001e413205eb7d452aa108aae574e0d1 Signed-off-by: Nick Beirne <[email protected]>
nbeirne
force-pushed
the
nbeirne/handle-read-errors
branch
from
November 12, 2026 18:08
128b5c9 to
accd59c
Compare
illotum
approved these changes
Nov 12, 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.
This continues the work in #21902, #22100, and #22223
tailscale/wireguard-go#116 changed the receive loop to retry any errors
other than net.ErrClosed without a delay. magicsock entered a spin loop
if it encountered a UDP read error.
magicsock's receive funcs now return only net.ErrClosed when the socket
actually closes. A IsUDPReadFeedback error is retried without delay and
other errors are retried after readErrRetryDelay.
Retrying errors may hide failures which used to stop the receive func.
errors.
broken. A warning is raised until a read succeeds.
Updates #22097