Give route-backed containers the full pinned dial budget and retry - #1848
Merged
Conversation
Pinned requests to route:// containers (every sandbox on a rented machine) were capped at a 900ms dial with no retry, while direct addresses got 3s plus one retry. Production metrics show healthy tunnel dials take 100-190ms and exceed 900ms under mild concurrency, so bursts turned into 502s at ~1.15s. Routes now get the same 3s budget, retry, and pinning, and the global route dial semaphore grows from 16 to 64 so one slow machine cannot serialize the whole gateway. Co-authored-by: Cursor <cursoragent@cursor.com>
mernit
approved these changes
Aug 16, 2026
The v1.72.1 tsnet embedded in the agent stops sending disco pings under symmetric NAT, pinning gateway-to-agent traffic on DERP relays (~140ms dials, intermittent failures). v1.102.2 negotiates direct paths again. Guard tsnet.Server.Close during recycling, which the newer library panics on for servers that never finished initializing. Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
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.
Root cause (measured in production)
The CNN sandbox burst failures (20% 502s at ~1.15s, throughput collapse to ~9 req/s) trace to the pinned-container path in the pod proxy. Every sandbox on a rented machine is addressed as
route://…, and that path got a 900ms dial budget with no retry, while direct addresses got 3s + one retry.Evidence from gateway metrics for the affected stub:
Fix
containerPinnedRouteDialTimeoutremoved.)backendRouteDialConcurrencyraised 16 → 64 so one slow machine cannot serialize dials for the whole gateway.Test plan
go test ./pkg/abstractions/pod/ ./pkg/network/passesMade with Cursor
Summary by cubic
Route-backed container dials now get the same pinned budget and retry as direct addresses, and embedded
tailscaleis bumped to v1.102.2 to restore direct paths and reduce relay-only flakiness. Old:route://used a 900ms dial with no retry and oldertailscaleoften stuck on DERP relays. New: 3s dial with one pre-connect retry and pinning;tailscalenegotiates direct connections and guardstsnet.Server.Close; stuck-opening routes now fail in ~6s instead of ~0.9s.Review and rollout
pkg/abstractions/pod/proxy.go: always usecontainerPinnedDialTimeout(3s), enable retry, pin; removecontainerPinnedRouteDialTimeout.pkg/network/backend_dialer.go.tailscaleto v1.102.2; addcloseTSNetServerand use it inpkg/network/tailscale.goto toleratetsnet.Server.Closepanics on wedged servers.Written for commit 06e351e. Summary will update on new commits.