Skip to content

Commit

Permalink
Fix wait recvloop timeout (tikv#1134)
Browse files Browse the repository at this point in the history
* wip

Signed-off-by: Ping Yu <[email protected]>

* CloseAddr with ver

Signed-off-by: Ping Yu <[email protected]>

* fix ErrConn

Signed-off-by: Ping Yu <[email protected]>

* fix ut

Signed-off-by: Ping Yu <[email protected]>

* cleanup

Signed-off-by: Ping Yu <[email protected]>

---------

Signed-off-by: Ping Yu <[email protected]>
  • Loading branch information
pingyu committed Mar 13, 2024
1 parent 5c52b86 commit e29a68e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/client/client_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,9 @@ func sendBatchRequest(
logutil.Logger(ctx).Debug("send request is cancelled",
zap.String("to", addr), zap.String("cause", ctx.Err().Error()))
return nil, errors.WithStack(ctx.Err())
case <-batchConn.closed:
logutil.Logger(ctx).Debug("send request is cancelled (batchConn closed)", zap.String("to", addr))
return nil, errors.New("batchConn closed")
case <-timer.C:
return nil, errors.WithMessage(context.DeadlineExceeded, "wait sendLoop")
}
Expand All @@ -893,6 +896,10 @@ func sendBatchRequest(
logutil.Logger(ctx).Debug("wait response is cancelled",
zap.String("to", addr), zap.String("cause", ctx.Err().Error()))
return nil, errors.WithStack(ctx.Err())
case <-batchConn.closed:
atomic.StoreInt32(&entry.canceled, 1)
logutil.Logger(ctx).Debug("wait response is cancelled (batchConn closed)", zap.String("to", addr))
return nil, errors.New("batchConn closed")
case <-timer.C:
atomic.StoreInt32(&entry.canceled, 1)
reason := fmt.Sprintf("wait recvLoop timeout,timeout:%s, wait_duration:%s:", timeout, waitDuration)
Expand Down

0 comments on commit e29a68e

Please sign in to comment.