diff options
| author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2025-12-02 12:50:33 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@tailscale.com> | 2025-12-02 15:12:13 -0800 |
| commit | 381de776c4878dd9af76b126cfa37bc80cad363f (patch) | |
| tree | c3ddcbf9613db3074c9c6882bb757357cf5bdd0a /control | |
| parent | b8c58ca7c1a49fb772d095c65693cdab06488047 (diff) | |
| download | tailscale-bradfitz/mutex_debug.tar.xz tailscale-bradfitz/mutex_debug.zip | |
syncs: start working on mutex debugging, registrationbradfitz/mutex_debug
Updates #17852
Change-Id: Ib1b634eedd30cc4006bc1b39aa8d479d37c5f1f2
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'control')
| -rw-r--r-- | control/controlbase/conn.go | 2 | ||||
| -rw-r--r-- | control/controlbase/handshake.go | 3 | ||||
| -rw-r--r-- | control/controlclient/auto.go | 5 | ||||
| -rw-r--r-- | control/controlclient/direct.go | 1 |
4 files changed, 8 insertions, 3 deletions
diff --git a/control/controlbase/conn.go b/control/controlbase/conn.go index 78ef73f71..8a3a90495 100644 --- a/control/controlbase/conn.go +++ b/control/controlbase/conn.go @@ -61,7 +61,7 @@ type rxState struct { // txState is all the Conn state that Write uses. type txState struct { - sync.Mutex + syncs.Mutex cipher cipher.AEAD nonce nonce err error // records the first partial write error for all future calls diff --git a/control/controlbase/handshake.go b/control/controlbase/handshake.go index 765a4620b..a57a3eca3 100644 --- a/control/controlbase/handshake.go +++ b/control/controlbase/handshake.go @@ -20,6 +20,7 @@ import ( chp "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/curve25519" "golang.org/x/crypto/hkdf" + "tailscale.com/syncs" "tailscale.com/types/key" ) @@ -186,6 +187,8 @@ func continueClientHandshake(ctx context.Context, conn net.Conn, s *symmetricSta cipher: c2, }, } + syncs.RegisterMutex(&c.rx.Mutex, "controlbase.Conn.rx.Mutex") + syncs.RegisterMutex(&c.tx.Mutex, "controlbase.Conn.tx.Mutex") return c, nil } diff --git a/control/controlclient/auto.go b/control/controlclient/auto.go index 336a8d491..235c5e03d 100644 --- a/control/controlclient/auto.go +++ b/control/controlclient/auto.go @@ -8,11 +8,11 @@ import ( "errors" "fmt" "net/http" - "sync" "sync/atomic" "time" "tailscale.com/net/sockstats" + "tailscale.com/syncs" "tailscale.com/tailcfg" "tailscale.com/tstime" "tailscale.com/types/key" @@ -122,7 +122,7 @@ type Auto struct { observerQueue execqueue.ExecQueue shutdownFn func() // to be called prior to shutdown or nil - mu sync.Mutex // mutex guards the following fields + mu syncs.Mutex // mutex guards the following fields started bool // whether [Auto.Start] has been called wantLoggedIn bool // whether the user wants to be logged in per last method call @@ -194,6 +194,7 @@ func newNoStart(opts Options) (_ *Auto, err error) { observer: opts.Observer, shutdownFn: opts.Shutdown, } + syncs.RegisterMutex(&c.mu, "controlclient.Auto.mu") c.authCtx, c.authCancel = context.WithCancel(context.Background()) c.authCtx = sockstats.WithSockStats(c.authCtx, sockstats.LabelControlClientAuto, opts.Logf) diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index d5cd6a13e..9680da0be 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -328,6 +328,7 @@ func NewDirect(opts Options) (*Direct, error) { dnsCache: dnsCache, dialPlan: opts.DialPlan, } + syncs.RegisterMutex(&c.mu, "controlclient.Direct.mu") c.discoPubKey = opts.DiscoPublicKey c.closedCtx, c.closeCtx = context.WithCancel(context.Background()) |
