From b29e19fd8ca870db0399c0ed151d9d3e03c34fbd Mon Sep 17 00:00:00 2001 From: qupeng Date: Tue, 30 Apr 2019 13:51:33 +0800 Subject: [PATCH] tikvclient: fix a bug that recreate connection forever (#10301) --- store/tikv/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/store/tikv/client.go b/store/tikv/client.go index 3a52a5f67de09..a6dc09fd99898 100644 --- a/store/tikv/client.go +++ b/store/tikv/client.go @@ -126,13 +126,13 @@ func (c *batchCommandsClient) batchRecvLoop(cfg config.TiKVClient) { // When `conn.Close()` is called, `client.Recv()` will return an error. resp, err := c.client.Recv() if err != nil { - if c.isStopped() { - return - } logutil.Logger(context.Background()).Error("batchRecvLoop error when receive", zap.Error(err)) now := time.Now() for { // try to re-create the streaming in the loop. + if c.isStopped() { + return + } // Hold the lock to forbid batchSendLoop using the old client. c.clientLock.Lock() c.failPendingRequests(err) // fail all pending requests.