mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-19 21:23:58 +00:00
wgengine/netstack: disable refsvfs2 leak tracking (#4378)
In addition an envknob (TS_DEBUG_NETSTACK_LEAK_MODE) now provides access to set leak tracking to more useful values. Fixes #4309 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
858ab80172
commit
c6ac29bcc4
@ -130,7 +130,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
|
|||||||
gvisor.dev/gvisor/pkg/linewriter from gvisor.dev/gvisor/pkg/log
|
gvisor.dev/gvisor/pkg/linewriter from gvisor.dev/gvisor/pkg/log
|
||||||
gvisor.dev/gvisor/pkg/log from gvisor.dev/gvisor/pkg/context+
|
gvisor.dev/gvisor/pkg/log from gvisor.dev/gvisor/pkg/context+
|
||||||
gvisor.dev/gvisor/pkg/rand from gvisor.dev/gvisor/pkg/tcpip/network/hash+
|
gvisor.dev/gvisor/pkg/rand from gvisor.dev/gvisor/pkg/tcpip/network/hash+
|
||||||
gvisor.dev/gvisor/pkg/refs from gvisor.dev/gvisor/pkg/refsvfs2
|
gvisor.dev/gvisor/pkg/refs from gvisor.dev/gvisor/pkg/refsvfs2+
|
||||||
gvisor.dev/gvisor/pkg/refsvfs2 from gvisor.dev/gvisor/pkg/tcpip/stack
|
gvisor.dev/gvisor/pkg/refsvfs2 from gvisor.dev/gvisor/pkg/tcpip/stack
|
||||||
💣 gvisor.dev/gvisor/pkg/sleep from gvisor.dev/gvisor/pkg/tcpip/transport/tcp
|
💣 gvisor.dev/gvisor/pkg/sleep from gvisor.dev/gvisor/pkg/tcpip/transport/tcp
|
||||||
💣 gvisor.dev/gvisor/pkg/state from gvisor.dev/gvisor/pkg/atomicbitops+
|
💣 gvisor.dev/gvisor/pkg/state from gvisor.dev/gvisor/pkg/atomicbitops+
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gvisor.dev/gvisor/pkg/refs"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip"
|
"gvisor.dev/gvisor/pkg/tcpip"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
|
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/buffer"
|
"gvisor.dev/gvisor/pkg/tcpip/buffer"
|
||||||
@ -54,6 +55,21 @@ const debugPackets = false
|
|||||||
|
|
||||||
var debugNetstack = envknob.Bool("TS_DEBUG_NETSTACK")
|
var debugNetstack = envknob.Bool("TS_DEBUG_NETSTACK")
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
var debugNetstackLeakMode = envknob.String("TS_DEBUG_NETSTACK_LEAK_MODE")
|
||||||
|
// Note: netstacks refsvfs2 package that will eventually replace refs
|
||||||
|
// consumes the refs.LeakMode setting, but enables some checks when set to
|
||||||
|
// UninitializedLeakChecking which is what empty string becomes. This mode
|
||||||
|
// is largely un-useful, so it is explicitly disabled here, and more useful
|
||||||
|
// modes can be set via the envknob. See #4309 for more references.
|
||||||
|
if debugNetstackLeakMode == "" {
|
||||||
|
debugNetstackLeakMode = "disabled"
|
||||||
|
}
|
||||||
|
var lm refs.LeakMode
|
||||||
|
lm.Set(debugNetstackLeakMode)
|
||||||
|
refs.SetLeakMode(lm)
|
||||||
|
}
|
||||||
|
|
||||||
// Impl contains the state for the netstack implementation,
|
// Impl contains the state for the netstack implementation,
|
||||||
// and implements wgengine.FakeImpl to act as a userspace network
|
// and implements wgengine.FakeImpl to act as a userspace network
|
||||||
// stack when Tailscale is running in fake mode.
|
// stack when Tailscale is running in fake mode.
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"gvisor.dev/gvisor/pkg/refs"
|
||||||
"inet.af/netaddr"
|
"inet.af/netaddr"
|
||||||
"tailscale.com/net/packet"
|
"tailscale.com/net/packet"
|
||||||
"tailscale.com/net/tsdial"
|
"tailscale.com/net/tsdial"
|
||||||
@ -74,3 +75,12 @@ func getMemStats() (ms runtime.MemStats) {
|
|||||||
runtime.ReadMemStats(&ms)
|
runtime.ReadMemStats(&ms)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNetstackLeakMode(t *testing.T) {
|
||||||
|
// See the comments in init(), and/or in issue #4309.
|
||||||
|
// Influenced by an envknob that may be useful in tests, so just check that
|
||||||
|
// it's not the oddly behaving zero value.
|
||||||
|
if refs.GetLeakMode() == 0 {
|
||||||
|
t.Fatalf("refs.leakMode is 0, want a non-zero value")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user