tidb panic with "runtime error: index out of range [3] with length 3"
- 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)
```
var TIDB_CLUSTERED_SORT = core.Case{
// Known false positive case:
// Order of upper case and lower case strings should be ignored when using case-insensitive collation. Currently we can't ignore it when asserting.
Name: "TIDB_CLUSTERED_SORT",
Run: func(ctx core.TestContext) (err error) {
defer Return(&err)
for _, rowVer := range []int{2, 1} {
config := func(s *sqlgen.State) {
s.SetWeight(sqlgen.DDLStmt, 0)
s.SetWeight(sqlgen.SplitRegion, 0)
s.SetWeight(sqlgen.Query, 15)
s.StoreConfig(sqlgen.ConfigKeyEnumLimitOrderBy, sqlgen.ConfigKeyEnumLOBLimitOrderBy)
}
t := newRandTest(defaultSteps, rowVer, config)
t.forceLowerCase = true
func() {
defer t.teardown()
// delete 'only_full_group_by' from sql_mode
t.start(ctx,
[]string{"set @@global.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';"},
false)
}()
}
return nil
},
}
```
### 2. What did you expect to see? (Required)
case run normally
### 3. What did you see instead (Required)
```
[2023/05/24 06:26:58.611 +00:00] [INFO] [conn.go:1184] ["command dispatched failed"] [conn=5815591877214208815] [connInfo="id:5815591877214208815, addr:[10.200.29.163:36228](http://10.200.29.163:36228/) status:10, collation:utf8mb4_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="delete tbl_24,tbl_12,tbl_4,tbl_0,tbl_22,tbl_20 from tbl_24,tbl_12,tbl_4,tbl_0,tbl_22,tbl_20 where tbl_12.col_92 in ( 0 ) order by tbl_22.col_138,tbl_22.col_139,tbl_22.col_140,tbl_22.col_141 limit 928"] [txn_mode=PESSIMISTIC] [timestamp=441688947050938377] [err="[parser:1064]You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 126 near \"order by tbl_22.col_138,tbl_22.col_139,tbl_22.col_140,tbl_22.col_141 limit 928\" "]
[2023/05/24 06:26:58.620 +00:00] [WARN] [2pc.go:1783] ["schemaLeaseChecker is not set for this transaction"] [sessionID=5815591877214208815] [startTS=441688947050938380] [checkTS=441688947050938381]
[2023/05/24 06:26:58.627 +00:00] [ERROR] [executor.go:1934] ["resultPuller panicked"] [conn=5815591877214208815] [recover="runtime error: index out of range [3] with length 3"] [stack="[github.com/pingcap/tidb/executor.(*UnionExec).resultPuller.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:1934\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:884\nruntime.goPanicIndex\n\t/usr/local/go/src/runtime/panic.go:113\ngithub.com/pingcap/tidb/util/chunk.(*Chunk).AppendPartialRows\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:657\ngithub.com/pingcap/tidb/util/chunk.(*Chunk).AppendRows\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:645\ngithub.com/pingcap/tidb/executor.(*TopNExec).Next\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/sort.go:426\ngithub.com/pingcap/tidb/executor.Next\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:326\ngithub.com/pingcap/tidb/executor.(*UnionExec).resultPuller\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:1964](http://github.com/pingcap/tidb/executor.(*UnionExec).resultPuller.func1/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:1934/nruntime.gopanic/n/t/usr/local/go/src/runtime/panic.go:884/nruntime.goPanicIndex/n/t/usr/local/go/src/runtime/panic.go:113/ngithub.com/pingcap/tidb/util/chunk.(*Chunk).AppendPartialRows/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:657/ngithub.com/pingcap/tidb/util/chunk.(*Chunk).AppendRows/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:645/ngithub.com/pingcap/tidb/executor.(*TopNExec).Next/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/sort.go:426/ngithub.com/pingcap/tidb/executor.Next/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:326/ngithub.com/pingcap/tidb/executor.(*UnionExec).resultPuller/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:1964)"]
[2023/05/24 06:26:58.628 +00:00] [INFO] [conn.go:1184] ["command dispatched failed"] [conn=5815591877214208815] [connInfo="id:5815591877214208815, addr:[10.200.29.163:36228](http://10.200.29.163:36228/) status:10, collation:utf8mb4_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="select col_125 from tbl_18 where not( tbl_18.col_125 in ( 1722242523 , 1555599462 , -1012012630 ) ) order by tbl_18.col_125 limit 954 for update"] [txn_mode=PESSIMISTIC] [timestamp=441688947064045569] [err="runtime error: index out of range [3] with length 3\[ngithub.com/pingcap/tidb/executor.(*UnionExec).resultPuller.func1\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:1935\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:884\nruntime.goPanicIndex\n\t/usr/local/go/src/runtime/panic.go:113\ngithub.com/pingcap/tidb/util/chunk.(*Chunk).AppendPartialRows\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:657\ngithub.com/pingcap/tidb/util/chunk.(*Chunk).AppendRows\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:645\ngithub.com/pingcap/tidb/executor.(*TopNExec).Next\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/sort.go:426\ngithub.com/pingcap/tidb/executor.Next\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:326\ngithub.com/pingcap/tidb/executor.(*UnionExec).resultPuller\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:1964\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1598](http://ngithub.com/pingcap/tidb/executor.(*UnionExec).resultPuller.func1/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:1935/nruntime.gopanic/n/t/usr/local/go/src/runtime/panic.go:884/nruntime.goPanicIndex/n/t/usr/local/go/src/runtime/panic.go:113/ngithub.com/pingcap/tidb/util/chunk.(*Chunk).AppendPartialRows/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:657/ngithub.com/pingcap/tidb/util/chunk.(*Chunk).AppendRows/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/chunk.go:645/ngithub.com/pingcap/tidb/executor.(*TopNExec).Next/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/sort.go:426/ngithub.com/pingcap/tidb/executor.Next/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:326/ngithub.com/pingcap/tidb/executor.(*UnionExec).resultPuller/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:1964/nruntime.goexit/n/t/usr/local/go/src/runtime/asm_amd64.s:1598)"]
```
### 4. What is your TiDB version? (Required)
[2023/05/24 06:13:48.090 +00:00] [INFO] [printer.go:48] ["Welcome to TiDB."] ["Release Version"=v7.1.0-dirty] [Edition=Community] ["Git Commit Hash"=fd2314159d1a81c8b13e5d61e53dcd527cb35494] ["Git Branch"=heads/refs/tags/v7.1.0] ["UTC Build Time"="2023-05-24 02:17:25"] [GoVersion=go1.20.3] ["Race Enabled"=false] ["Check Table Before Drop"=false] ["TiKV Min Version"=6.2.0-alpha]
Contributor guide
Assessment
This issue has not been assessed yet.