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: invalid memory address or nil pointer dereference, upgrade from 4.0.16 to v5.3.0 #30501

Closed
seiya-annie opened this issue Dec 7, 2021 · 4 comments · Fixed by #30602
Assignees
Labels
severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@seiya-annie
Copy link

seiya-annie commented Dec 7, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

upgrade from 4.0.16 to v5.3.0

MySQL [randgen]> SELECT DISTINCT SUM( INSTR( col_double_undef_unsigned, col_char(20)_key_signed ) ) AS field1 FROM lt WHERE IF( 'm', "but", ('2013-07-27' LIKE col_char(20)_undef_signed )) GROUP BY NULLIF( col_double_undef_unsigned, col_float_key_signed ) ORDER BY CAST( "think" AS UNSIGNED ) LIMIT 68;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
MySQL [randgen]> exit

Min Reproduce Step
SELECT DISTINCT INSTR( col_double_undef_unsigned, col_char(20)_key_signed) FROM table_90_latin1_4 ;

show_create_table.txt
data.txt

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

[conn.go:986] ["connection running loop panic"] [conn=63] [lastSQL="SELECT DISTINCT SUM( INSTR( `col_double_undef_unsigned`, `col_char(20)_key_signed` ) ) AS field1 FROM table_90_latin1_4 WHERE IF( 'm', \"but\", ( '2013-07-27' LIKE `col_char(20)_undef_signed` ) ) GROUP BY NULLIF( `col_double_undef_unsigned`, `col_float_key_signed` ) ORDER BY CAST( \"think\" AS UNSIGNED ) LIMIT 68"] [err="runtime error: invalid memory address or nil pointer dereference"] [stack="goroutine 141478 [running]:\ngithub.com/pingcap/tidb/server.(*clientConn).Run.func1(0x42b4970, 0xc003608c60, 0xc0034cc000)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:984 +0xf5\npanic(0x3905020, 0x5a1b440)\n\t/usr/local/go/src/runtime/panic.go:965 +0x1b9\ngithub.com/pingcap/tidb/planner/core.(*basePhysicalAgg).ResolveIndices(0xc00780cee0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:392 +0x247\ngithub.com/pingcap/tidb/planner/core.(*basePhysicalPlan).ResolveIndices(0xc005cf9688, 0xc007b9def8, 0x128e3bb)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:651 +0x63\ngithub.com/pingcap/tidb/planner/core.(*physicalSchemaProducer).ResolveIndices(0xc005cf9680, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:640 +0x31\ngithub.com/pingcap/tidb/planner/core.(*basePhysicalPlan).ResolveIndices(0xc00780ce08, 0xc0075d0900, 0x100000000000000)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:651 +0x63\ngithub.com/pingcap/tidb/planner/core.(*physicalSchemaProducer).ResolveIndices(...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:640\ngithub.com/pingcap/tidb/planner/core.(*basePhysicalAgg).ResolveIndices(0xc00780ce00, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:386 +0x46\ngithub.com/pingcap/tidb/planner/core.(*basePhysicalPlan).ResolveIndices(0xc00780cd28, 0xc007ba1350, 0xc003270ac0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:651 +0x63\ngithub.com/pingcap/tidb/planner/core.(*physicalSchemaProducer).ResolveIndices(...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:640\ngithub.com/pingcap/tidb/planner/core.(*basePhysicalAgg).ResolveIndices(0xc00780cd20, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:386 +0x46\ngithub.com/pingcap/tidb/planner/core.(*basePhysicalPlan).ResolveIndices(0xc00200bb88, 0xc003684a40, 0xc007cd11c8)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:651 +0x63\ngithub.com/pingcap/tidb/planner/core.(*physicalSchemaProducer).ResolveIndices(0xc00200bb80, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/resolve_indices.go:640 +0x31\ngithub.com/pingcap/tidb/planner/core.physicalOptimize(0x42fa9b8, 0xc00780cc40, 0xc004d279e8, 0x42fa9b8, 0xc00780cb60, 0x42fa9b8, 0xc00780cc40, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/optimizer.go:383 +0x243\ngithub.com/pingcap/tidb/planner/core.DoOptimize(0x42b4970, 0xc006558a50, 0x42fed38, 0xc005da7c00, 0x5dea, 0x42fa9b8, 0xc00780cc40, 0x0, 0x0, 0x0, ...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/core/optimizer.go:235 +0x185\ngithub.com/pingcap/tidb/planner.optimize(0x42b4970, 0xc006558a50, 0x42fed38, 0xc005da7c00, 0x42cd6e8, 0xc0053453b0, 0x42f3eb8, 0xc006028700, 0x0, 0x0, ...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/optimize.go:389 +0x6eb\ngithub.com/pingcap/tidb/planner.Optimize(0x42b4970, 0xc006558a50, 0x42fed38, 0xc005da7c00, 0x42cd6e8, 0xc0053453b0, 0x42f3eb8, 0xc006028700, 0x0, 0x0, ...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/planner/optimize.go:220 +0x1334\ngithub.com/pingcap/tidb/ex"]
no panic

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

v5.3.0

@seiya-annie seiya-annie added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner severity/major labels Dec 7, 2021
@seiya-annie
Copy link
Author

please check whether a duplicate issue with #30426

@AilinKid AilinKid self-assigned this Dec 9, 2021
@AilinKid
Copy link
Contributor

AilinKid commented Dec 9, 2021

How can I get the binary v4.0.16? I test migration from v4.0.15 to v5.3.0, it seems fine.

@AilinKid
Copy link
Contributor

AilinKid commented Dec 9, 2021

tiup start v5.3.0 (with new collation opened)
create table
load data local infile '/home/arenatlx/download/data.txt' into table table_90_latin1_4;
SELECT DISTINCT SUM... // two error log, and a panic

mainly caused by the function clone (missed the repertoire which leading the error in deriveCollation when getFunction)

@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

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.

2 participants