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

executor panicked for "runtime error: invalid memory address or nil pointer dereference" #54206

Closed
seiya-annie opened this issue Jun 25, 2024 · 9 comments · Fixed by #54311
Closed
Assignees

Comments

@seiya-annie
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1;
drop table if exists t2;
create table t1(a bigint, b bigint);
create table t2(a bigint, b bigint);
insert into t1 values(1, 1);
mysql>  select t1.a+t1.b as result from t1 left join t2 on 1 = 0 order by result;
+--------+
| result |
+--------+
|      2 |
+--------+
1 row in set (0.00 sec)

mysql>  select t1.a+t1.b as result from t1 left join t2 on 1 = 0 order by result limit 1;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
mysql> explain select t1.a+t1.b as result from t1 left join t2 on 1 = 0 order by result limit 1;
+------------------------------------------+---------+-----------+---------------+------------------------------------------------------------+
| id                                       | estRows | task      | access object | operator info                                              |
+------------------------------------------+---------+-----------+---------------+------------------------------------------------------------+
| Projection_9                             | 1.00    | root      |               | plus(test.t1.a, test.t1.b)->Column#7                       |
| └─Projection_25                          | 1.00    | root      |               | test.t1.a, test.t1.b                                       |
|   └─TopN_12                              | 1.00    | root      |               | Column#9, offset:0, count:1                                |
|     └─Projection_26                      | 1.00    | root      |               | test.t1.a, test.t1.b, plus(test.t1.a, test.t1.b)->Column#9 |
|       └─HashJoin_14                      | 1.00    | root      |               | CARTESIAN left outer join                                  |
|         ├─TableDual_22(Build)            | 0.00    | root      |               | rows:0                                                     |
|         └─Projection_23(Probe)           | 1.00    | root      |               | test.t1.a, test.t1.b                                       |
|           └─TopN_16                      | 1.00    | root      |               | Column#8, offset:0, count:1                                |
|             └─Projection_24              | 1.00    | root      |               | test.t1.a, test.t1.b, plus(test.t1.a, test.t1.b)->Column#8 |
|               └─TableReader_21           | 1.00    | root      |               | data:TopN_20                                               |
|                 └─TopN_20                | 1.00    | cop[tikv] |               | plus(test.t1.a, test.t1.b), offset:0, count:1              |
|                   └─TableFullScan_19     | 1.00    | cop[tikv] | table:t1      | keep order:false, stats:pseudo                             |
+------------------------------------------+---------+-----------+---------------+------------------------------------------------------------+
12 rows in set (0.01 sec)

mysql> 

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

3. What did you see instead (Required)

2024-06-25 18:48:52 (UTC+08:00)TiDB 127.0.0.1:4000[sort_util.go:52] ["executor panicked"] [error="runtime error: invalid memory address or nil pointer dereference"] [stack="github.com/pingcap/tidb/pkg/executor/sortexec.processPanicAndLog\n\t/Users/pingcap/workspace/bp-tidb-release-darwin-arm64-xfhw7-build-binaries/source/tidb/pkg/executor/sortexec/sort_util.go:52\ngithub.com/pingcap/tidb/pkg/executor/sortexec.(*TopNExec).executeTopN.func1\n\t/Users/pingcap/workspace/bp-tidb-release-darwin-arm64-xfhw7-build-binaries/source/tidb/pkg/executor/sortexec/topn.go:443\nruntime.gopanic\n\t/usr/local/go1.21/src/runtime/panic.go:914\nruntime.panicmem\n\t/usr/local/go1.21/src/runtime/panic.go:261\nruntime.sigpanic\n\t/usr/local/go1.21/src/runtime/signal_unix.go:861\ngithub.com/pingcap/tidb/pkg/executor/sortexec.

4. What is your TiDB version? (Required)

01cc027

@seiya-annie
Copy link
Author

no error report on :
Git Commit Hash: 1368bf7
Git Branch: heads/refs/tags/v8.2.0-alpha
UTC Build Time: 2024-06-24 11:46:26

@xzhangxian1008
Copy link
Contributor

Hi, i can't reproduce this. Can you try to reproduce it again and provide more detail?

@xzhangxian1008
Copy link
Contributor

/remove-label may-affects-5.4

@ti-chi-bot ti-chi-bot bot removed the may-affects-5.4 This bug maybe affects 5.4.x versions. label Jun 28, 2024
@xzhangxian1008
Copy link
Contributor

/remove-label may-affects-6.1

@xzhangxian1008
Copy link
Contributor

/remove-label may-affects-6.5

@xzhangxian1008
Copy link
Contributor

/remove-label may-affects-7.1

@xzhangxian1008
Copy link
Contributor

/remove-label may-affects-7.5

@xzhangxian1008
Copy link
Contributor

/remove-label may-affects-8.1

@xzhangxian1008
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants