Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the MaxConns semaphore issue in HostClient. #1831

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,17 @@ func (c *HostClient) releaseConn(cc *clientConn) {
w := q.popFront()
if w.waiting() {
delivered = w.tryDeliver(cc, nil)
break
// This is the last resort to hand over conCount sema.
// We must ensure that there are no valid waiters in connsWait
// when we exit this loop.
//
// We did not apply the same looping pattern in the decConnsCount
// method because it needs to create a new time-spent connection,
// and the decConnsCount call chain will inevitably reach this point.
// When MaxConnWaitTimeout>0.
if delivered {
break
}
}
}
}
Expand Down