-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
v5.1.0, tidb panicked with runtime error: index out of range [-1] #25812
Comments
please check whether it is a known issue. |
@seiya-annie Would you please provide the row data with INSERT? It's a little hard to re-create the table with data inserted |
ok, i will found insert sql later |
reproduce steps:
|
[conn.go:801] ["connection running loop panic"] [conn=149] [lastSQL="select * from t1 where c_str > some (select c_str from t2 where c_decimal < 5) for update"] [err="runtime error: index out of range [-1]"] [stack="goroutine 169461 [running]:\ngithub.com/pingcap/tidb/server.(*clientConn).Run.func1(0x3c13118, 0xc002328570, 0xc0000df400)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:799 +0xf5\npanic(0x3550540, 0xc00134e630)\n\t/usr/local/go/src/runtime/panic.go:965 +0x1b9\ngithub.com/pingcap/tidb/executor.(*ExecStmt).Exec.func1(0xc00399bd40, 0xc003bcab10, 0xc003bcaaf0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/adapter.go:332 +0x4d4\npanic(0x3550540, 0xc00134e630)\n\t/usr/local/go/src/runtime/panic.go:965 +0x1b9\ngithub.com/pingcap/tidb/util/chunk.Row.GetInt64(...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/chunk/row.go:52\ngithub.com/pingcap/tidb/executor.(*SelectLockExec).Next(0xc001ae96b0, 0x3c13118, 0xc0036b55f0, 0xc0028e4f00, 0xc002913400, 0xc0006546c0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/executor.go:933 +0x845\ngithub.com/pingcap/tidb/executor.Next(0x3c13118, 0xc0036b55f0, 0x3c17738, 0xc001ae96b0, 0xc0028e4f00, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/executor.go:286 +0x2de\ngithub.com/pingcap/tidb/executor.(*ExecStmt).runPessimisticSelectForUpdate(0xc00399bd40, 0x3c13118, 0xc0036b55f0, 0x3c17738, 0xc001ae96b0, 0x0, 0x0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/adapter.go:543 +0x285\ngithub.com/pingcap/tidb/executor.(*ExecStmt).handlePessimisticSelectForUpdate(0xc00399bd40, 0x3c13118, 0xc0036b55f0, 0x3c17738, 0xc001ae96b0, 0x57b5ce0, 0x3c13103, 0x0, 0x203000)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/adapter.go:524 +0x5d\ngithub.com/pingcap/tidb/executor.(*ExecStmt).Exec(0xc00399bd40, 0x3c13118, 0xc0036b55f0, 0x0, 0x0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/adapter.go:416 +0xb49\ngithub.com/pingcap/tidb/session.runStmt(0x3c13118, 0xc003866930, 0xc00120da40, 0x3c29098, 0xc00399bd40, 0x0, 0x0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/session/session.go:1635 +0x37f\ngithub.com/pingcap/tidb/session.(*session).ExecuteStmt(0xc00120da40, 0x3c13118, 0xc003866930, 0x3c2d7e8, 0xc0029a5950, 0x0, 0x0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/session/session.go:1530 +0xaab\ngithub.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt(0xc002328d50, 0x3c13118, 0xc003866930, 0x3c2d7e8, 0xc0029a5950, 0xc000621680, 0x3c13118, 0xc003866930, 0xc003bcb0d0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/driver_tidb.go:218 +0x68\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmt(0xc0000df400, 0x3c13070, 0xc003866930, 0x3c2d7e8, 0xc0029a5950, 0x57e8de0, 0x0, 0x0, 0x1, 0x0, ...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:1691 +0x1bb\ngithub.com/pingcap/tidb/server.(*clientConn).handleQuery(0xc0000df400, 0x3c13070, 0xc001764c40, 0xc0046025a1, 0x59, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:1563 +0x492\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch(0xc0000df400, 0x3c13070, 0xc001764c40, 0xc0046025a0, 0x5a, 0x59, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:1097 +0xafd\ngithub.com/pingcap/tidb/server.(*clientConn).Run(0xc0000df400, 0x3c13118, 0xc002328570)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:860 +0x296\ngithub.com/pingcap/tidb/server.(*Server).onConn(0xc00101e1a0, 0xc0000df400)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/p"] |
It's strange that we cannot reproduce it on the master branch even if it's a branch before we checkout the v5.1 branch |
still exist in 5.2.0 |
@seiya-annie It seems PR#28141 closed, and would you please verify if the problem is solved or still there? |
/assign yisaer |
/unassign winoros |
The panic has been fixed in #26380, and the bug fixing has been merged in v5.1.2. plz upgrade to v5.1.2 or higher to avoid this problem. |
Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
execute SQL:
"select * from t1 where c_decimal <= all (select c_decimal from t2 where c_datetime > '2020-02-29 09:40:31') for update"
tables:
MySQL [db2__38f42204_2463_4648_aa21_50a0b66835a7]> show create table t1;
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t1 | CREATE TABLE
t1
(c_int
int(11) NOT NULL,c_str
varchar(40) NOT NULL,c_datetime
datetime DEFAULT NULL,c_timestamp
timestamp NULL DEFAULT NULL,c_double
double DEFAULT NULL,c_decimal
decimal(12,6) DEFAULT NULL,PRIMARY KEY (
c_int
,c_str
) /*T![clustered_index] NONCLUSTERED */,KEY
c_int_2
(c_int
),KEY
c_str
(c_str
),KEY
c_datetime
(c_datetime
),KEY
c_timestamp
(c_timestamp
)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY HASH(
c_int
)PARTITIONS 4 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
MySQL [db2__38f42204_2463_4648_aa21_50a0b66835a7]> show create table t2;
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t2 | CREATE TABLE
t2
(c_int
int(11) DEFAULT NULL,c_str
varchar(40) DEFAULT NULL,c_datetime
datetime DEFAULT NULL,c_timestamp
timestamp NULL DEFAULT NULL,c_double
double DEFAULT NULL,c_decimal
decimal(12,6) DEFAULT NULL,UNIQUE KEY
c_str
(c_str
),KEY
c_decimal
(c_decimal
)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
MySQL [db2__38f42204_2463_4648_aa21_50a0b66835a7]> select * from t1;
+-------+------------------+---------------------+---------------------+-----------+-----------+
| c_int | c_str | c_datetime | c_timestamp | c_double | c_decimal |
+-------+------------------+---------------------+---------------------+-----------+-----------+
| 9 | adoring wu | 2020-01-15 17:47:08 | 2020-05-22 01:40:57 | 96.112838 | 8.821000 |
| 13 | lucid driscoll | 2020-01-02 13:56:32 | 2020-02-20 01:52:23 | 99.68412 | 7.275000 |
| 4 | admiring jemison | 2020-04-19 20:49:03 | 2020-03-27 19:59:41 | 70.372352 | 4.402000 |
| 12 | vigorous meitner | 2020-01-23 19:04:40 | 2020-03-12 04:50:05 | 12.412372 | 6.663000 |
| 12 | charming taussig | 2020-06-15 21:56:09 | 2020-02-11 04:13:56 | 72.127955 | 0.379000 |
| 6 | agitated khorana | 2020-03-09 07:54:53 | 2020-02-08 11:21:23 | 85.321686 | 4.683000 |
| 3 | boring solomon | 2020-06-11 00:19:49 | 2020-01-10 16:10:38 | 16.63727 | 6.987000 |
| 3 | frosty wilbur | 2020-06-02 13:37:38 | 2020-05-12 21:39:32 | 55.727316 | 2.990000 |
| 11 | modest tharp | 2020-05-24 07:16:15 | 2020-06-22 02:20:09 | 18.242227 | 4.924000 |
+-------+------------------+---------------------+---------------------+-----------+-----------+
9 rows in set (0.01 sec)
MySQL [db2__38f42204_2463_4648_aa21_50a0b66835a7]> select * from t2;
+-------+-------------------------+---------------------+---------------------+-----------+-----------+
| c_int | c_str | c_datetime | c_timestamp | c_double | c_decimal |
+-------+-------------------------+---------------------+---------------------+-----------+-----------+
| 1 | wizardly dewdney | 2020-05-30 21:08:10 | 2020-02-27 22:36:51 | 80.593312 | 3.325000 |
| 2 | relaxed goldwasser | 2020-03-05 21:03:41 | 2020-05-21 06:27:39 | 76.052927 | 4.491000 |
| 10 | trusting blackburn | 2020-02-11 14:19:39 | 2020-03-22 18:39:15 | 85.288783 | 7.212000 |
| 11 | upbeat wu | 2020-03-01 11:58:03 | 2020-06-12 18:48:25 | 46.392315 | 9.294000 |
| 11 | elegant jemison | 2020-01-14 02:47:50 | 2020-01-26 22:04:34 | 24.716133 | 1.968000 |
| 12 | stoic lichterman | 2020-04-21 13:54:15 | 2020-06-30 05:02:56 | 66.913576 | 2.602000 |
| 10 | fervent lewin | 2020-04-05 03:45:15 | 2020-04-07 02:19:43 | 25.054941 | 9.160000 |
| 10 | intelligent stonebraker | 2020-05-03 12:34:35 | 2020-04-10 14:10:57 | 19.391548 | 6.024000 |
+-------+-------------------------+---------------------+---------------------+-----------+-----------+
8 rows in set (0.00 sec)
MySQL [db2__38f42204_2463_4648_aa21_50a0b66835a7]>
2. What did you expect to see? (Required)
3. What did you see instead (Required)
[2021/06/29 10:35:02.269 +08:00] [ERROR] [projection.go:455] ["projection executor panicked"] [error="runtime error: index out of range [-1]"] [stack="goroutine 88941574 [running]:\ngithub.com/pingcap/tidb/util.GetStack(...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/misc.go:73\ngithub.com/pingcap/tidb/executor.recoveryProjection(0xc0083c4c40, 0x352b340, 0xc0041609c0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:454 +0x96\ngithub.com/pingcap/tidb/executor.(*projectionInputFetcher).run.func1(0xc00098af50, 0xc0045e4a80)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:356 +0x85\npanic(0x352b340, 0xc0041609c0)\n\t/usr/local/go/src/runtime/panic.go:965 +0x1b9\ngithub.com/pingcap/tidb/util/chunk.Row.GetInt64(...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/chunk/row.go:52\ngithub.com/pingcap/tidb/executor.(*SelectLockExec).Next(0xc00361c000, 0x3bea2f8, 0xc00775ea50, 0xc0015b73b0, 0xc000a2ce28, 0x10c6d45)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/executor.go:933 +0x845\ngithub.com/pingcap/tidb/executor.Next(0x3bea2f8, 0xc00775ea50, 0x3bee938, 0xc00361c000, 0xc0015b73b0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/executor.go:286 +0x2de\ngithub.com/pingcap/tidb/executor.(*projectionInputFetcher).run(0xc0045e4a80, 0x3bea2f8, 0xc00775ea50)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:380 +0x254\ncreated by github.com/pingcap/tidb/executor.(*ProjectionExec).prepare\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:271 +0x73c\n"]
[2021/06/29 10:35:02.270 +08:00] [WARN] [session.go:1551] ["run statement failed"] [conn=413] [schemaVersion=1237] [error="runtime error: index out of range [-1]"] [session="{\n "currDBName": "db2__38f42204_2463_4648_aa21_50a0b66835a7",\n "id": 413,\n "preparedStmtCount": 1800,\n "status": 3,\n "strictMode": true,\n "txn": "425966725292097537",\n "user": {\n "Username": "root",\n "Hostname": "172.16.5.197",\n "CurrentUser": false,\n "AuthUsername": "root",\n "AuthHostname": "%"\n }\n}"]
4. What is your TiDB version? (Required)
| Release Version: v5.1.0
Edition: Community
Git Commit Hash: 7784454
Git Branch: heads/refs/tags/v5.1.0
UTC Build Time: 2021-06-22 03:26:55
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
The text was updated successfully, but these errors were encountered: