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

runtime error: index out of range [-1] #22828

Closed
Thearas opened this issue Feb 19, 2021 · 2 comments · Fixed by #22833
Closed

runtime error: index out of range [-1] #22828

Thearas opened this issue Feb 19, 2021 · 2 comments · Fixed by #22833
Labels
severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@Thearas
Copy link

Thearas commented Feb 19, 2021

Bug Report

1. Minimal reproduce step (Required)

drop table if exists t1;
CREATE TABLE t1 (c int);
select group_concat((select concat(c,group_concat(c)) FROM t1 where xxx=xxx)) FROM t1;

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

No panic.

3. What did you see instead (Required)

Panic:

[2021/02/19 20:07:15.135 +08:00] [ERROR] [conn.go:734] ["connection running loop panic"] [conn=13] [lastSQL="select group_concat(c order by (select concat(c,group_concat(c)) FROM t1  where xxx=xxx)) FROM t1"] [err="runtime error: index out of range [-1]"] [stack="goroutine 6422 [running]:\ngithub.com/pingcap/tidb/server.(*clientConn).Run.func1(0x3f8cfe0, 0xc001296b70, 0xc000cb7100)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/server/conn.go:732 +0xee\npanic(0x3732c80, 0xc0014cf360)\n\t/usr/local/go/src/runtime/panic.go:679 +0x1b2\ngithub.com/pingcap/tidb/planner/core.buildFuncDependCol(0x3fe0540, 0xc00054cf00, 0x3fc4cc0, 0xc000e8a500, 0x1, 0x0)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:2578 +0x2e2\ngithub.com/pingcap/tidb/planner/core.buildWhereFuncDepend(0x3fe0540, 0xc00054cf00, 0x3fc4cc0, 0xc000e8a500, 0xc0010270b0)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:2585 +0xd3\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).checkOnlyFullGroupByWithOutGroupClause(0xc00111f500, 0x3fe0540, 0xc00054cf00, 0xc000cb7500, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:2890 +0x2cc\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).checkOnlyFullGroupBy(0xc00111f500, 0x3fe0540, 0xc00054cf00, 0xc000cb7500, 0x1, 0x1)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:2759 +0x99\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).buildSelect(0xc00111f500, 0x3f8cfe0, 0xc001297680, 0xc000cb7500, 0x3fe0540, 0xc00054cf00, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:3332 +0x1c13\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).buildResultSetNode(0xc00111f500, 0x3f8cfe0, 0xc001297680, 0x3fabc80, 0xc000cb7500, 0xc001027770, 0x134359b, 0x203000, 0x342c460)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:376 +0x974\ngithub.com/pingcap/tidb/planner/core.(*expressionRewriter).buildSubquery(0xc00163cb60, 0x3f8cfe0, 0xc001297680, 0xc001238bd0, 0x0, 0x0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/expression_rewriter.go:325 +0x9e\ngithub.com/pingcap/tidb/planner/core.(*expressionRewriter).handleScalarSubquery(0xc00163cb60, 0x3f8cfe0, 0xc001297680, 0xc001238bd0, 0x13426ab, 0xc00003e000, 0x36c1640)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/expression_rewriter.go:947 +0x6a\ngithub.com/pingcap/tidb/planner/core.(*expressionRewriter).Enter(0xc00163cb60, 0x3fac220, 0xc001238bd0, 0xc001027b20, 0x136780a, 0xc00054c780)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/expression_rewriter.go:392 +0x91a\ngithub.com/pingcap/parser/ast.(*SubqueryExpr).Accept(0xc001238bd0, 0x3f55160, 0xc00163cb60, 0xc00054c780, 0xc001027bf0, 0x3fc4dc0)\n\t/home/jenkins/agent/workspace/tidb_master/go/pkg/mod/github.com/pingcap/[email protected]/ast/expressions.go:384 +0x4b\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).rewriteExprNode(0xc00111f500, 0xc00163cb60, 0x3fc56c0, 0xc001238bd0, 0xc00054c701, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/expression_rewriter.go:195 +0x8e\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).rewriteWithPreprocess(0xc00111f500, 0x3f8cfe0, 0xc001297680, 0x3fc56c0, 0xc001238bd0, 0x3fe0540, 0xc00054c780, 0x0, 0x0, 0x1b30801, ...)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/expression_rewriter.go:142 +0x163\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).rewrite(0xc00111f500, 0x3f8cfe0, 0xc001297680, 0x3fc56c0, 0xc001238bd0, 0x3fe0540, 0xc00054c780, 0x0, 0xc0012fa201, 0x0, ...)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/expression_rewriter.go:110 +0xb9\ngithub.com/pingcap/tidb/planner/core.(*PlanBuilder).buildAggregation(0xc00111f500, 0x3f8cfe0, 0xc001297680, 0x3fe0540, 0xc00054c780, 0xc0004f8f20, 0x1, 0x1, 0x0, 0x0, ...)\n\t/home/jenkins/agent/workspace/tidb_master/"]

4. What is your TiDB version? (Required)

Release Version: v4.0.0-beta.2-2140-g937472423-dirty
Edition: Community
Git Commit Hash: 937472423112000c875f7c8607aa57b4b31eaf10
Git Branch: master
UTC Build Time: 2021-02-18 16:17:53
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@Thearas Thearas added the type/bug The issue is confirmed as a bug. label Feb 19, 2021
@jebter jebter added the sig/planner SIG: Planner label Feb 20, 2021
@ti-srebot
Copy link
Contributor

ti-srebot commented Feb 22, 2021

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

[v4.0.0:v4.0.11],[v5.0.0-rc]

6. Fixed versions

master

@ti-srebot
Copy link
Contributor

( FixedVersions ) fields are empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants