Skip to content

Commit 6f5de38

Browse files
authored
Merge pull request #626 from djs55/lock-order
go: don't hold the metadata mutex and then acquire the channel mutex
2 parents 66d9f18 + 5cd2bd2 commit 6f5de38

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

go/pkg/libproxy/multiplexed.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,14 +574,20 @@ func (m *multiplexer) DumpState(w io.Writer) {
574574
}
575575
})
576576
m.eventsM.Unlock()
577+
578+
var channels []*channel
577579
m.metadataMutex.Lock()
578-
io.WriteString(w, "Active channels:\n")
579580
for _, c := range m.channels {
581+
channels = append(channels, c)
582+
}
583+
m.metadataMutex.Unlock()
584+
585+
io.WriteString(w, "Active channels:\n")
586+
for _, c := range channels {
580587
io.WriteString(w, c.String())
581588
io.WriteString(w, "\n")
582589
}
583590
io.WriteString(w, "End of state dump\n")
584-
m.metadataMutex.Unlock()
585591
}
586592

587593
// IsRunning returns whether the multiplexer is running or not

0 commit comments

Comments
 (0)