mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-23 17:16:29 +00:00
util/execqueue: don't hold mutex in RunSync
We don't hold q.mu while running normal ExecQueue.Add funcs, so we shouldn't in RunSync either. Otherwise code it calls can't shut down the queue, as seen in #18502. Updates #18052 Co-authored-by: Nick Khyl <nickk@tailscale.com> Change-Id: Ic5e53440411eca5e9fabac7f4a68a9f6ef026de1 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
b7658a4ad2
commit
8af7778ce0
@@ -20,3 +20,12 @@ func TestExecQueue(t *testing.T) {
|
||||
t.Errorf("n=%d; want 1", got)
|
||||
}
|
||||
}
|
||||
|
||||
// Test that RunSync doesn't hold q.mu and block Shutdown
|
||||
// as we saw in tailscale/tailscale#18502
|
||||
func TestExecQueueRunSyncLocking(t *testing.T) {
|
||||
q := &ExecQueue{}
|
||||
q.RunSync(t.Context(), func() {
|
||||
q.Shutdown()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user