Skip to content

Commit

Permalink
set inflight chan buffer to 2 for deadlock
Browse files Browse the repository at this point in the history
It is possible for dispatchRequest and broadcastErr to both send a
result down the inflight[] channel which has a buffer of 1, so would
work for one of them then block on the other. If broadcastErr went
first, then dispatchRequest would block causing the client to hang.
  • Loading branch information
eikenb committed Feb 7, 2018
1 parent 0159c83 commit 22e9c1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ type idmarshaler interface {
}

func (c *clientConn) sendPacket(p idmarshaler) (byte, []byte, error) {
ch := make(chan result, 1)
ch := make(chan result, 2)
c.dispatchRequest(ch, p)
s := <-ch
return s.typ, s.data, s.err
Expand Down

0 comments on commit 22e9c1c

Please sign in to comment.