pingcap / pingcap/tidb

Online workload preempt cpu and make lightning checksum stuck in queue

Open
#46,448 9 comments 0 reactions 0 assignees View on GitHub
affects-7.5 affects-8.1 affects-8.5 component/lightning may-affects-5.3 may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 severity/major type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)

Use lightning to import 3T data while running online workload, encounter warnings:
```
[2023/08/25 15:35:38.020 +00:00] [WARN] [checksum.go:315] ["remote checksum failed"] [db=airbnbsim] [table=t1] [error="other error: Coprocessor task terminated due to exceeding the deadline; other error: Coprocessor task terminated due to exceeding the deadline; other error: Coprocessor task terminated due to exceeding the deadline; other error: Coprocessor task terminated due to exceeding the deadline; other error: Coprocessor task terminated due to exceeding the deadline; other error: Coprocessor task terminated due to exceeding the deadline; other error: Coprocessor task terminated due to exceeding the deadline; other error: Coprocessor task terminated due to exceeding the deadline"] [errorVerbose="the following errors occurred:\n - other error: Coprocessor task terminated due to exceeding the deadline\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1347\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1225\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1106\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:799\n runtime.goexit\n \t/usr/local/go/src/runtime/asm_amd64.s:1598\n - other error: Coprocessor task terminated due to exceeding the deadline\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1347\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1225\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1106\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:799\n runtime.goexit\n \t/usr/local/go/src/runtime/asm_amd64.s:1598\n - other error: Coprocessor task terminated due to exceeding the deadline\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1347\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1225\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1106\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:799\n runtime.goexit\n \t/usr/local/go/src/runtime/asm_amd64.s:1598\n - other error: Coprocessor task terminated due to exceeding the deadline\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1347\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1225\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1106\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:799\n runtime.goexit\n \t/usr/local/go/src/runtime/asm_amd64.s:1598\n - other error: Coprocessor task terminated due to exceeding the deadline\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1347\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1225\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1106\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:799\n runtime.goexit\n \t/usr/local/go/src/runtime/asm_amd64.s:1598\n - other error: Coprocessor task terminated due to exceeding the deadline\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1347\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1225\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1106\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:799\n runtime.goexit\n \t/usr/local/go/src/runtime/asm_amd64.s:1598\n - other error: Coprocessor task terminated due to exceeding the deadline\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1347\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1225\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1106\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:799\n runtime.goexit\n \t/usr/local/go/src/runtime/asm_amd64.s:1598\n - other error: Coprocessor task terminated due to exceeding the deadline\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1347\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1225\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1106\n github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n \t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:799\n runtime.goexit\n \t/usr/local/go/src/runtime/asm_amd64.s:1598"] [concurrency=15] [retry=0]
```

```
[2023/08/31 13:00:09.926 +00:00] [WARN] [checksum.go:297] ["remote checksum failed"] [db=airbnbsim] [table=t1] [error="wait recvLoop: context deadline exceeded"] [errorVerbose="context deadline exceeded\nwait recvLoop\ngithub.com/pingcap/errors.AddStack\n\t/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20220729040631-518f63d66278/errors.go:174\ngithub.com/pingcap/errors.Trace\n\t/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20220729040631-518f63d66278/juju_adaptor.go:15\ngithub.com/pingcap/tidb/store/driver/error.ToTiDBErr\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/driver/error/error.go:169\ngithub.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:1042\ngithub.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:943\ngithub.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/store/copr/coprocessor.go:653\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1594"] [concurrency=7] [retry=1]
```

We encounter the above 2 warnings which **led to "remote checksum failed" error** in 3 separate lightning import tests, and the reasons are the same, which is some region's checksum took too long to execute (more than 1 minute) and then timed out, the reason should be that the online workload preempted the cpu and caused checksum, a low priority task, to wait too long in the queue.

We suggest to set the timeout of pertask in kv request longer, to avoid frequent deadline kills and infinite retries during busy period.

### 2. What did you expect to see? (Required)
No error.
### 3. What did you see instead (Required)
The error above.
### 4. What is your TiDB version? (Required)

```
Release Version: v6.5.4-with-kv-timeout-feature
Edition: Community
Git Commit Hash: 19afd53c729e658ce9955160534ef90038d11a44
Git Branch: heads/refs/tags/v6.5.4-with-kv-timeout-feature
UTC Build Time: 2023-08-24 07:20:27
GoVersion: go1.19.12
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.