# [FAQ] TiDB 日志 “send request is cancelled” 和 “wait response is cancelled” 解释

## Key Words

send request is cancelled，wait response is cancelled, context canceled

## Description

### TiDB 日志报错

```text
[2022/11/08 03:17:39.894 +08:00] [WARN] [client_batch.go:778] ["send request is cancelled"] [to=10.33.11.175:20160] [cause="context canceled"]
[2022/11/08 03:17:39.894 +08:00] [WARN] [client_batch.go:794] ["wait response is cancelled"] [to=10.33.11.175:20160] [cause="context canceled"]
```

## Content

1. send request is cancelled: TiDB 默认配置 [Max batch size in gRPC 值为 128](https://docs.pingcap.com/zh/tidb/stable/tidb-configuration-file#max-batch-size)，超过该值，则 Batch Client 会出现请求处理堆积。当请求发送阶段超时，常规办法是可以排查监控 Grafana >TiDB > Batch Client/Pending Request Count by TiKV 是否大于 128，如果 Pending Request 不多，需要排查日志确认是否因为对应 KV 有运维变更，导致短暂报出；否则非预期，需报 bug。 

    <https://github.com/pingcap/tidb/issues/29190> 在 v5 版本以后已经将该参数调整为 "Debug" 模式，实际参考性比较低。

2. wait response is cancelled: 请求发送到 TiKV 后超时未收到 TiKV 响应。需要排查对应地址 TiKV 的响应时间和对应 Region 在当时的 PD 和 KV 日志，确定为什么 KV 未及时响应。