Repository navigation
Conversation
Make magicsock continue, with a backoff, on any read error except net.ErrClosed. Add a recv err metric, and make receive func explicitly mark itself unhealthy since we can't rely on the number of calls. Cleared by a successful read, or opening a new generation of receive funcs. A raw EBADF or ENOTSOCK on a read mean an external closer destroyed the socket, and rebind is attempted. On Windows the Winsock numbers are matched instead, following neterror.IsClosedPipeError. Updates #22097 Signed-off-by: Alex Valiushko <[email protected]> Change-Id: Ib964129e26c6f865edcd6cc7d52b10176a6a6964
nbeirne
added a commit
that referenced
this pull request
Nov 5, 2026
This iterates on the work in #21902, #22100 and tailscale/wireguard-go#116. The new version of wireguard-go discards the deathSpiral loop in favour of allowing Bind's ReceiveFunc to pace read retries. This code is the other side. Add back a backoff for non-feedback errors, and report the receive func as broken to the health tracker once reads have been failing for 30s. The loop only exits once net.ErrClosed is returned. Updates #22097 Change-Id: I9f1134242c3cb5ac2ef3c282cf7bcd7606cb5b9e Signed-off-by: Nick Beirne <[email protected]> . Change-Id: Iccfb5e3746d212856978e9f539f848fccf85058a .
nbeirne
added a commit
that referenced
this pull request
Nov 5, 2026
This iterates on the work in #21902, #22100 and tailscale/wireguard-go#116. The new version of wireguard-go discards the deathSpiral loop in favour of allowing Bind's ReceiveFunc to pace read retries. This code is the other side. Add back a backoff for non-feedback errors, and report the receive func as broken to the health tracker once reads have been failing for 30s. The loop only exits once net.ErrClosed is returned. Updates #22097 Change-Id: I9f1134242c3cb5ac2ef3c282cf7bcd7606cb5b9e Signed-off-by: Nick Beirne <[email protected]> . Change-Id: Iccfb5e3746d212856978e9f539f848fccf85058a .
nbeirne
added a commit
that referenced
this pull request
Nov 5, 2026
This iterates on the work in #21902, #22100 and tailscale/wireguard-go#116. The new version of wireguard-go discards the deathSpiral loop in favour of allowing Bind's ReceiveFunc to pace read retries. This code is the other side. Add back a backoff for non-feedback errors, and report the receive func as broken to the health tracker once reads have been failing for 30s. The loop only exits once net.ErrClosed is returned. Updates #22097 Change-Id: I9f1134242c3cb5ac2ef3c282cf7bcd7606cb5b9e Signed-off-by: Nick Beirne <[email protected]>
nbeirne
added a commit
that referenced
this pull request
Nov 6, 2026
This iterates on the work in #21902, #22100 and tailscale/wireguard-go#116. The new version of wireguard-go discards the deathSpiral loop in favour of allowing Bind's ReceiveFunc to pace read retries. This code is the other side. Add back a backoff for non-feedback errors, and report the receive func as broken to the health tracker once reads have been failing for 30s. The loop only exits once net.ErrClosed is returned. Updates #22097 Change-Id: I9f1134242c3cb5ac2ef3c282cf7bcd7606cb5b9e Signed-off-by: Nick Beirne <[email protected]>
nbeirne
added a commit
that referenced
this pull request
Nov 6, 2026
This iterates on the work in #21902, #22100 and tailscale/wireguard-go#116. wireguard-go no longer has a deathSpiral loop; it relies on the Bind's ReceiveFunc to pace read retries. This is the magicsock side of that change. On read errors other than truncation and UDP read feedback, the receive func now sleeps 100ms and retries rather than returning. If reads keep failing for 30s it marks itself broken via ReceiveFuncStats.SetBroken. The next successful read clears that state. Updates #22097 Change-Id: I9f1134242c3cb5ac2ef3c282cf7bcd7606cb5b9e Signed-off-by: Nick Beirne <[email protected]>
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.
Make magicsock continue, with a backoff, on any read error except net.ErrClosed. Add a recv err metric, and make receive func explicitly mark itself unhealthy since we can't rely on the number of calls. Cleared by a successful read, or opening a new generation of receive funcs.
A raw EBADF or ENOTSOCK on a read mean an external closer destroyed the socket, and rebind is attempted. On Windows the Winsock numbers are matched instead, following neterror.IsClosedPipeError.
Updates #22097
Change-Id: Ib964129e26c6f865edcd6cc7d52b10176a6a6964