Skip to content

tailcat: let proxied gVisor TCP connections finish teardown - #83

Merged
bradfitz merged 1 commit into
mainfrom
bradfitz/deflake_more
Sep 4, 2026
Merged

tailcat: let proxied gVisor TCP connections finish teardown#83
bradfitz merged 1 commit into
mainfrom
bradfitz/deflake_more

Conversation

@bradfitz

@bradfitz bradfitz commented Sep 4, 2026

Copy link
Copy Markdown
Member

ProxyConns propagates EOF in each direction with CloseWrite, then used to
call Close on both connections as soon as its copy loops returned. For a
gonet.TCPConn, that changes the gVisor endpoint to application-closed
immediately after its FIN was queued. If the FIN is lost around that
transition, the peer can wait forever for EOF.

When the peer FIN has already arrived, subscribe to gVisor’s hangup event
and give the local FIN up to five seconds to be acknowledged before the
final Close. The wait happens entirely inside ProxyConns, is bounded if
the peer disappears, and preserves its simple ownership contract: it
closes both connections before returning.

Together with the outstanding tailscale.com netcheck race fix
(tailscale/tailscale#21086), this completed 12,203 TestServeExitNode runs
over 30 minutes without a failure. The netcheck fix prevents spurious
rebinds; this change independently prevents a lost teardown FIN from
wedging the client.

Updates #71
Updates #73

ProxyConns propagates EOF in each direction with CloseWrite, then used to
call Close on both connections as soon as its copy loops returned. For a
gonet.TCPConn, that changes the gVisor endpoint to application-closed
immediately after its FIN was queued. If the FIN is lost around that
transition, the peer can wait forever for EOF.

When the peer FIN has already arrived, subscribe to gVisor’s hangup event
and give the local FIN up to five seconds to be acknowledged before the
final Close. The wait happens entirely inside ProxyConns, is bounded if
the peer disappears, and preserves its simple ownership contract: it
closes both connections before returning.

Together with the outstanding tailscale.com netcheck race fix
(tailscale/tailscale#21086), this completed 12,203 TestServeExitNode runs
over 30 minutes without a failure. The netcheck fix prevents spurious
rebinds; this change independently prevents a lost teardown FIN from
wedging the client.

Updates #71
Updates #73

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
@bradfitz
bradfitz merged commit 2d846ae into main Sep 4, 2026
6 checks passed
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