mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(coderd): avoid deadlock in (*logFollower).follow (#7983)
This commit is contained in:
@@ -318,6 +318,10 @@ func (f *logFollower) follow() {
|
||||
return
|
||||
}
|
||||
defer subCancel()
|
||||
// Move cancel up the stack so it happens before unsubscribing,
|
||||
// otherwise we can end up in a deadlock due to how the
|
||||
// in-memory pubsub does mutex locking on send/unsubscribe.
|
||||
defer cancel()
|
||||
|
||||
// we were provided `complete` prior to starting this subscription, so
|
||||
// we also need to check whether the job is now complete, in case the
|
||||
|
||||
Reference in New Issue
Block a user