Skip to content

wgengine/magicsock: rebind on EPIPE/ECONNRESET - #14551

Merged
raggi merged 1 commit into
mainfrom
raggi/rebind-on-epipe
Jan 7, 2025
Merged

raggi merged 1 commit into
mainfrom
raggi/rebind-on-epipe

Conversation

@raggi

@raggi raggi commented Jan 6, 2025

Copy link
Copy Markdown
Member

Observed in the wild some macOS machines gain broken sockets coming out of sleep (we observe "time jumped", followed by EPIPE on sendto). The cause of this in the platform is unclear, but the fix is clear: always rebind if the socket is broken. This can also be created artificially on Linux via ss -K, and other conditions or software on a system could also lead to the same outcomes.

Updates tailscale/corp#25648

@raggi
raggi requested a review from bradfitz January 6, 2025 20:35
Comment thread wgengine/magicsock/magicsock.go Resolved
raggi added a commit that referenced this pull request Jan 6, 2025
Remove the platform specificity, it is unnecessary complexity.
Deduplicate repeated code as a result of reduced complexity.
Split out error identification code.
Update call-sites and tests.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
raggi added a commit that referenced this pull request Jan 6, 2025
Remove the platform specificity, it is unnecessary complexity.
Deduplicate repeated code as a result of reduced complexity.
Split out error identification code.
Update call-sites and tests.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
raggi added a commit that referenced this pull request Jan 6, 2025
Remove the platform specificity, it is unnecessary complexity.
Deduplicate repeated code as a result of reduced complexity.
Split out error identification code.
Update call-sites and tests.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
raggi added a commit that referenced this pull request Jan 6, 2025
Remove the platform specificity, it is unnecessary complexity.
Deduplicate repeated code as a result of reduced complexity.
Split out error identification code.
Update call-sites and tests.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
@raggi
raggi force-pushed the raggi/rebind-on-epipe branch 2 times, most recently from df59d02 to 5921c89 Compare January 6, 2025 21:43
Observed in the wild some macOS machines gain broken sockets coming out
of sleep (we observe "time jumped", followed by EPIPE on sendto). The
cause of this in the platform is unclear, but the fix is clear: always
rebind if the socket is broken. This can also be created artificially on
Linux via `ss -K`, and other conditions or software on a system could
also lead to the same outcomes.

Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
@raggi
raggi force-pushed the raggi/rebind-on-epipe branch from 5921c89 to f270c15 Compare January 7, 2025 17:53
raggi added a commit that referenced this pull request Jan 7, 2025
Remove the platform specificity, it is unnecessary complexity.
Deduplicate repeated code as a result of reduced complexity.
Split out error identification code.
Update call-sites and tests.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
@raggi
raggi merged commit f4f57b8 into main Jan 7, 2025
@raggi
raggi deleted the raggi/rebind-on-epipe branch January 7, 2025 18:02
raggi added a commit that referenced this pull request Jan 7, 2025
Remove the platform specificity, it is unnecessary complexity.
Deduplicate repeated code as a result of reduced complexity.
Split out error identification code.
Update call-sites and tests.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
raggi added a commit that referenced this pull request Jan 7, 2025
Remove the platform specificity, it is unnecessary complexity.
Deduplicate repeated code as a result of reduced complexity.
Split out error identification code.
Update call-sites and tests.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
thirdeyenick pushed a commit to ninech/tailscale that referenced this pull request Jul 2, 2025
Remove the platform specificity, it is unnecessary complexity.
Deduplicate repeated code as a result of reduced complexity.
Split out error identification code.
Update call-sites and tests.

Updates tailscale#14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
raggi added a commit that referenced this pull request Sep 25, 2025
On platforms that are causing EPIPE at a high frequency this is
resulting in non-working connections, for example when Apple decides to
forcefully close UDP sockets due to an unsoliced packet rejection in the
firewall.

Too frequent rebinds cause a failure to solicit the endpoints triggering
the rebinds, that would normally happen via CallMeMaybe.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
mikeodr pushed a commit that referenced this pull request Sep 26, 2025
On platforms that are causing EPIPE at a high frequency this is
resulting in non-working connections, for example when Apple decides to
forcefully close UDP sockets due to an unsoliced packet rejection in the
firewall.

Too frequent rebinds cause a failure to solicit the endpoints triggering
the rebinds, that would normally happen via CallMeMaybe.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
raggi added a commit that referenced this pull request Oct 14, 2025
On platforms that are causing EPIPE at a high frequency this is
resulting in non-working connections, for example when Apple decides to
forcefully close UDP sockets due to an unsoliced packet rejection in the
firewall.

Too frequent rebinds cause a failure to solicit the endpoints triggering
the rebinds, that would normally happen via CallMeMaybe.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <[email protected]>
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.

2 participants