Skip to content

Commit ea8eeeb

Browse files
committed
feature/relayserver: fix Shutdown() deadlock (tailscale#17898)
Updates tailscale#17894 Signed-off-by: Jordan Whited <jordan@tailscale.com> (cherry picked from commit 0285e1d)
1 parent 0f421d3 commit ea8eeeb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

feature/relayserver/relayserver.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,13 @@ func (e *extension) stopRelayServerLocked() {
246246

247247
// Shutdown implements [ipnlocal.Extension].
248248
func (e *extension) Shutdown() error {
249+
// [extension.mu] must not be held when closing the [eventbus.Client]. Close
250+
// blocks until all [eventbus.SubscribeFunc]'s have returned, and the ones
251+
// used in this package also acquire [extension.mu]. See #17894.
252+
e.ec.Close()
249253
e.mu.Lock()
250254
defer e.mu.Unlock()
251255
e.shutdown = true
252-
e.ec.Close()
253256
e.stopRelayServerLocked()
254257
return nil
255258
}

0 commit comments

Comments
 (0)