SIGN IN SIGN UP

ipn/ipnlocal: avoid deadlocks during shutdown

LocalBackend.Shutdown waits for the ACME refresh loop and active SSH
sessions. Both can be blocked acquiring LocalBackend.mu, so waiting while
holding that mutex deadlocks shutdown.

Detach the SSH server under the mutex, then stop both subsystems after
releasing it. Prevent their work from restarting once shutdown begins, and
serialize repeated Shutdown calls with sync.Once.

Add regression tests that verify subsystem shutdown runs without
LocalBackend.mu held.

Updates tailscale/corp#45964

Change-Id: I37ead4f26fbfb5703a83882668d98a8862ba7d67
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
B
Brad Fitzpatrick committed
4c4d1c35f83a21c6069ae09de69b246ed1993f3e
Parent: d645114
Committed by Brad Fitzpatrick <brad@danga.com> on 8/1/2026, 8:57:38 PM