Skip to content

Commit 5b2ea2e

Browse files
coadlerspikecurtis
andauthored
fix(tailnet): disable wireguard trimming (#9098)
Co-authored-by: Spike Curtis <spike@coder.com>
1 parent e4c24e0 commit 5b2ea2e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tailnet/conn.go

+17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"golang.org/x/xerrors"
2121
"gvisor.dev/gvisor/pkg/tcpip"
2222
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
23+
"tailscale.com/envknob"
2324
"tailscale.com/ipn/ipnstate"
2425
"tailscale.com/net/connstats"
2526
"tailscale.com/net/dns"
@@ -64,6 +65,22 @@ func init() {
6465
// Globally disable network namespacing. All networking happens in
6566
// userspace.
6667
netns.SetEnabled(false)
68+
// Tailscale, by default, "trims" the set of peers down to ones that we are
69+
// "actively" communicating with in an effort to save memory. Since
70+
// Tailscale removed keep-alives, it seems like open but idle connections
71+
// (SSH, port-forward, etc) can get trimmed fairly easily, causing hangs for
72+
// a few seconds while the connection is setup again.
73+
//
74+
// Note that Tailscale.com's use case is very different from ours: in their
75+
// use case, users create one persistent tailnet per device, and it allows
76+
// connections to every other thing in Tailscale that belongs to them. The
77+
// tailnet stays up as long as your laptop or phone is turned on.
78+
//
79+
// Our use case is different: for clients, it's a point-to-point connection
80+
// to a single workspace, and lasts only as long as the connection. For
81+
// agents, it's connections to a small number of clients (CLI or Coderd)
82+
// that are being actively used by the end user.
83+
envknob.Setenv("TS_DEBUG_TRIM_WIREGUARD", "false")
6784
}
6885

6986
type Options struct {

0 commit comments

Comments
 (0)