Skip to content

Commit b29e19f

Browse files
hicquzz-jason
authored andcommitted
tikvclient: fix a bug that recreate connection forever (#10301)
1 parent cf0ca74 commit b29e19f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

store/tikv/client.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ func (c *batchCommandsClient) batchRecvLoop(cfg config.TiKVClient) {
126126
// When `conn.Close()` is called, `client.Recv()` will return an error.
127127
resp, err := c.client.Recv()
128128
if err != nil {
129-
if c.isStopped() {
130-
return
131-
}
132129
logutil.Logger(context.Background()).Error("batchRecvLoop error when receive", zap.Error(err))
133130

134131
now := time.Now()
135132
for { // try to re-create the streaming in the loop.
133+
if c.isStopped() {
134+
return
135+
}
136136
// Hold the lock to forbid batchSendLoop using the old client.
137137
c.clientLock.Lock()
138138
c.failPendingRequests(err) // fail all pending requests.

0 commit comments

Comments
 (0)