From 0c1e3ff625bf05dc64521294ae0d49191da9c070 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 1 Sep 2023 10:58:43 -0700 Subject: [PATCH] ipn/ipnlocal: avoid calling Start from resetForProfileChangeLockedOnEntry During Shutdown of an ephemeral node, we called Logout (to best effort delete the node earlier), which then called back into resetForProfileChangeLockedOnEntry, which then tried to Start again. That's all a waste of work during shutdown and complicates other cleanups coming later. Updates #cleanup Change-Id: I0b8648cac492fc70fa97c4ebef919bbe352c5d7b Co-authored-by: Maisem Ali Signed-off-by: Brad Fitzpatrick --- ipn/ipnlocal/local.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 9ea569a29..c7f81f81b 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -4930,6 +4930,13 @@ func (b *LocalBackend) initTKALocked() error { // // b.mu must held on entry. It is released on exit. func (b *LocalBackend) resetForProfileChangeLockedOnEntry() error { + if b.shutdownCalled { + // Prevent a call back to Start during Shutdown, which calls Logout for + // ephemeral nodes, which can then call back here. But we're shutting + // down, so no need to do any work. + b.mu.Unlock() + return nil + } b.setNetMapLocked(nil) // Reset netmap. // Reset the NetworkMap in the engine b.e.SetNetworkMap(new(netmap.NetworkMap))