Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidb panic with "runtime error: index out of range [10] with length 10" while executing select statement #24000

Closed
seiya-annie opened this issue Apr 14, 2021 · 1 comment
Labels
duplicate Issues or pull requests already exists. type/bug The issue is confirmed as a bug.

Comments

@seiya-annie
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

MySQL [clustered]> select * from PK_MULTI_COL_4799 where col1 > 0xFB50F2B806101A3B2295 AND col2 > 0xFB50F2B806101A3B2295;
ERROR 1105 (HY000): runtime error: index out of range [10] with length 10

MySQL [clustered]> select * from PK_MULTI_COL_4799 where col1 > 0xFB50F2B806101A3B2295;
Empty set (0.01 sec)

MySQL [clustered]> select * from PK_MULTI_COL_4799 where col2 > 0xFB50F2B806101A3B2295;
ERROR 1105 (HY000): runtime error: index out of range [10] with length 10
MySQL [clustered]>

MySQL [clustered]> show create table PK_MULTI_COL_4799;
Table | Create Table |
+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| PK_MULTI_COL_4799 | CREATE TABLE PK_MULTI_COL_4799 (
COL1 binary(10) NOT NULL,
COL2 char(1) COLLATE utf8_general_ci NOT NULL,
COL3 double NOT NULL,
PRIMARY KEY (COL1(5),COL2,COL3) /*T![clustered_index] NONCLUSTERED */,
UNIQUE KEY UIDXM (COL1(5),COL2),
UNIQUE KEY UIDX (COL2),
KEY IDX3 (COL3),
KEY IDXM (COL3,COL2)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci |

2. What did you expect to see? (Required)

SQL can run without error

3. What did you see instead (Required)

[2021/04/14 12:53:30.999 +08:00] [ERROR] [conn.go:736] ["connection running loop panic"] [conn=63621] [lastSQL="select * from PK_MULTI_COL_4799 where col1 > 0xFB50F2B806101A3B2295 AND col2 > 0xFB50F2B806101A3B2295"] [err="runtime error: index out of range [10] with length 10"] [stack="goroutine 131515528 [running]:\ngithub.com/pingcap/tidb/server.(*clientConn).Run.func1(0x3ff6060, 0xc047511410, 0xc044f82400)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:734 +0xee\npanic(0x378df20, 0xc04c02d600)\n\t/usr/local/go/src/runtime/panic.go:679 +0x1b2\ngithub.com/pingcap/tidb/util/collate.decodeRune(0xc04e62d604, 0xa, 0x9, 0xa, 0xc)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/collate/collate.go:262 +0x129\ngithub.com/pingcap/tidb/util/collate.(*generalCICollator).Key(0x5f82ce0, 0xc04e62d604, 0xa, 0x5f82ce0, 0x20, 0x3484960)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/collate/general_ci.go:48 +0xcd\ngithub.com/pingcap/tidb/util/codec.encodeString(0xc04c02d5c0, 0x0, 0x13, 0x5, 0x0, 0xc01beb2d80, 0xf, 0xc04e62d604, 0xa, 0xa, ...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/codec/codec.go:200 +0x171\ngithub.com/pingcap/tidb/util/codec.encode(0xc034f28300, 0xc04c02d5c0, 0x0, 0x13, 0xc0349c75d8, 0x1, 0x1, 0x1359b01, 0xc03503a5f0, 0x50, ...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/codec/codec.go:94 +0x569\ngithub.com/pingcap/tidb/util/codec.EncodeKey(...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/codec/codec.go:287\ngithub.com/pingcap/tidb/util/ranger.validInterval(0xc034f28300, 0xc03503a5f0, 0xc03503a5a0, 0xc03503a5a0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/ranger/ranger.go:36 +0x189\ngithub.com/pingcap/tidb/util/ranger.points2Ranges(0xc034f28300, 0xc043013900, 0x2, 0x4, 0xc050ed98c0, 0x2, 0x2, 0x0, 0xc043013900, 0x2)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/ranger/ranger.go:66 +0x1ab\ngithub.com/pingcap/tidb/util/ranger.(*rangeDetacher).buildCNFIndexRange(0xc0349c7b30, 0xc03296b3a8, 0x2, 0x2, 0x0, 0xc034e6f120, 0x1, 0x1, 0x1, 0x0, ...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/ranger/ranger.go:365 +0x764\ngithub.com/pingcap/tidb/util/ranger.(*rangeDetacher).detachCNFCondAndBuildRangeForIndex(0xc0349c7b30, 0xc034e6f0c0, 0x1, 0x1, 0xc03296b3a8, 0x1, 0x1, 0xc0349c7a01, 0x1f554d1, 0xc03a4ace00, ...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/
/panic

4. What is your TiDB version? (Required)

v5.0.0

@seiya-annie seiya-annie added the type/bug The issue is confirmed as a bug. label Apr 14, 2021
@xiongjiwei xiongjiwei added the duplicate Issues or pull requests already exists. label Apr 14, 2021
@xiongjiwei
Copy link
Contributor

xiongjiwei commented Apr 14, 2021

close because duplicate with #23506
/cc @seiya-annie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues or pull requests already exists. type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants