From e7482f0df016e5b3e7acf67b1152fa70e02e42a4 Mon Sep 17 00:00:00 2001 From: Will Norris Date: Wed, 1 Nov 2023 15:26:33 -0700 Subject: [PATCH] ipn/ipnlocal: prevent deadlock on WebClientShutdown WebClientShutdown tries to acquire the b.mu lock, so run it in a go routine so that it can finish shutdown after setPrefsLockedOnEntry is finished. This is the same reason b.sshServer.Shutdown is run in a go routine. Updates tailscale/corp#14335 Signed-off-by: Will Norris --- ipn/ipnlocal/local.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 111cc0dab..074b813fa 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -3013,7 +3013,7 @@ func (b *LocalBackend) setPrefsLockedOnEntry(caller string, newp *ipn.Prefs) ipn } } if oldp.ShouldWebClientBeRunning() && !newp.ShouldWebClientBeRunning() { - b.WebClientShutdown() + go b.WebClientShutdown() } if netMap != nil { newProfile := netMap.UserProfiles[netMap.User()]