You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/ipn
Nick Khyl d199ecac80 ipn/ipnlocal: shut down old control client synchronously on reset
Previously, callers of (*LocalBackend).resetControlClientLocked were supposed
to call Shutdown on the returned controlclient.Client after releasing b.mu.
In #17804, we started calling Shutdown while holding b.mu, which caused
deadlocks during profile switches due to the (*ExecQueue).RunSync implementation.

We first patched this in #18053 by calling Shutdown in a new goroutine,
which avoided the deadlocks but made TestStateMachine flaky because
the shutdown order was no longer guaranteed.

In #18070, we updated (*ExecQueue).RunSync to allow shutting down
the queue without waiting for RunSync to return. With that change,
shutting down the control client while holding b.mu became safe.

Therefore, this PR updates (*LocalBackend).resetControlClientLocked
to shut down the old client synchronously during the reset, instead of
returning it and shifting that responsibility to the callers.

This fixes the flaky tests and simplifies the code.

Fixes #18052

Signed-off-by: Nick Khyl <nickk@tailscale.com>
1 day ago
..
auditlog syncs: add Mutex/RWMutex alias/wrappers for future mutex debugging 3 weeks ago
conffile cmd/tailscale/cli,ipn/conffile: add declarative config mode for Services (#17435) 2 months ago
desktop go.mod: bump golang.org/x/crypto (#17907) 3 weeks ago
ipnauth all: use buildfeature constants in a few more places 2 months ago
ipnext ipn/ipnlocal: remove all the weird locking (LockedOnEntry, UnlockEarly, etc) 3 weeks ago
ipnlocal ipn/ipnlocal: shut down old control client synchronously on reset 1 day ago
ipnserver feature/featuretags, all: add build features, use existing ones in more places 2 months ago
ipnstate cmd/tailscale, ipn/ipnstate, wgengine/magicsock: update ping output for peer relay (#16515) 5 months ago
lapitest various: allow tailscaled shutdown via LocalAPI 2 months ago
localapi cmd/tailscaled,ipn: show a health warning when state store fails to open (#17883) 2 weeks ago
policy ipn,tailconfig: clean up unreleased and removed app connector service 2 years ago
store ipn/store, feature/condregister: permit callers to empty import optonal ipn stores 2 months ago
backend.go types/netmap: remove PrivateKey from NetworkMap 3 weeks ago
backend_test.go ipn: fix the string representation of an empty ipn.Notify 3 months ago
conf.go ipn: ensure that conffile is source of truth for advertised services. (#15361) 9 months ago
doc.go ipn: generate LoginProfileView and use it instead of *LoginProfile where appropriate 10 months ago
ipn_clone.go cmd/tailscale/cli,ipn,all: make peer relay server port a *uint16 1 week ago
ipn_test.go all: do not depend on the testing package 2 years ago
ipn_view.go cmd/tailscale/cli,ipn,all: make peer relay server port a *uint16 1 week ago
prefs.go cmd/tailscale/cli,ipn,all: make peer relay server port a *uint16 1 week ago
prefs_test.go cmd/tailscale/cli,ipn,all: make peer relay server port a *uint16 1 week ago
serve.go ipn/serve: validate service paths in HasPathHandler 1 week ago
serve_test.go ipn/serve: validate service paths in HasPathHandler 1 week ago
store.go cmd/tailscaled,ipn: show a health warning when state store fails to open (#17883) 2 weeks ago
store_test.go ipn/store: automatically migrate between plaintext and encrypted state (#16318) 5 months ago