Query cluster table with panic after setting tidb_store_limit
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
mysql > set global tidb_store_limit=10;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from information_schema.cluster_slow_query limit 1;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
mysql> select * from information_schema.cluster_processlist limit 1;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
```
### 2. What did you expect to see? (Required)
No error
### 3. What did you see instead (Required)
```
[err="runtime error: invalid memory address or nil pointer dereference\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTask.func1\n\t/workspace/source/tidb/pkg/store/copr/coprocessor.go:1109\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:914\nruntime.panicmem\n\t/usr/local/go/src/runtime/panic.go:261\nruntime.sigpanic\n\t/usr/local/go/src/runtime/signal_unix.go:861\ngithub.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).getStoreToken\n\t/root/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.8-0.20240920100427-3725b31fa3c0/internal/locate/region_request.go:2012\ngithub.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).sendReqToRegion\n\t/root/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.8-0.20240920100427-3725b31fa3c0/internal/locate/region_request.go:1834\ngithub.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).SendReqCtx\n\t/root/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.8-0.20240920100427-3725b31fa3c0/internal/locate/region_request.go:1656\ngithub.com/tikv/client-go/v2/txnkv/txnsnapshot.(*ClientHelper).SendReqCtx\n\t/root/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.8-0.20240920100427-3725b31fa3c0/txnkv/txnsnapshot/client_helper.go:146\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTaskOnce\n\t/workspace/source/tidb/pkg/store/copr/coprocessor.go:1227\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTask\n\t/workspace/source/tidb/pkg/store/copr/coprocessor.go:1119\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).run\n\t/workspace/source/tidb/pkg/store/copr/coprocessor.go:792\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1650"]
```
### 4. What is your TiDB version? (Required)
v7.5.4
Contributor guide
Research direction
Reproduce the failure with the reported tidb_store_limit setting and cluster table queries, then read pkg/store/copr/coprocessor.go around copIteratorWorker.handleTask and handleTaskOnce. The stack trace also points to client-go's internal/locate/region_request.go getStoreToken path. Done means both queries return without a nil-pointer panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100