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:runtime error: index out of range [8000] with length 1680 #42459

Closed
jebter opened this issue Mar 22, 2023 · 1 comment · Fixed by #42482
Closed

tidb panic:runtime error: index out of range [8000] with length 1680 #42459

jebter opened this issue Mar 22, 2023 · 1 comment · Fixed by #42482
Assignees
Labels

Comments

@jebter
Copy link

jebter commented Mar 22, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Found tidb panic in ci's regression tests
[2023-03-21T12:59:44.591Z] File: /home/jenkins/agent/git/tiflash/integrated/ops/ti.sh.cmds/ci/fullstack_tests/randgen-mpp/agg_subquery_10000.test

[2023-03-21T12:59:44.591Z] Error line: 246

[2023-03-21T12:59:44.591Z] Error: tiflash use subquery_agg10000; set @@tidb_isolation_read_engines='tiflash,tidb'; set @@tidb_allow_mpp=1;SELECT ( table1 . col_char_64 , table1 . col_char_64_not_null ) IN ( SELECT SUBQUERY1_t1 . col_char_64_not_null AS SUBQUERY1_field1 , count( SUBQUERY1_t1 . col_varchar_64_not_null ) AS SUBQUERY1_field2 FROM A AS SUBQUERY1_t1 INNER JOIN ( M AS SUBQUERY1_t2 LEFT JOIN DD AS SUBQUERY1_t3 ON (SUBQUERY1_t3 . col_decimal_30_10_key = SUBQUERY1_t2 . col_decimal_40 )) ON (SUBQUERY1_t3 . col_char_64_not_null = SUBQUERY1_t2 . col_varchar_key ) GROUP BY SUBQUERY1_field1 ) AS field1 , ( table1 . col_decimal_40_key , table1 . col_bigint_not_null ) NOT IN ( SELECT 3 , 2 UNION SELECT 9, 2 ) AS field2 , ( 4, 8 ) IN ( SELECT SUBQUERY3_t1 . col_tinyint_not_null AS SUBQUERY3_field1 , SUBQUERY3_t1 . col_tinyint_not_null AS SUBQUERY3_field2 FROM L AS SUBQUERY3_t1 LEFT OUTER JOIN ( L AS SUBQUERY3_t2 INNER JOIN CC AS SUBQUERY3_t3 ON (SUBQUERY3_t3 . col_decimal_key = SUBQUERY3_t2 . col_int_key )) ON (SUBQUERY3_t3 . col_tinyint_not_null = SUBQUERY3_t2 . pk ) GROUP BY SUBQUERY3_field1 , SUBQUERY3_field2 ) AS field3 , table1 . col_bigint_not_null = SOME ( SELECT 0 UNION SELECT 2 ) AS field4 FROM ( SELECT SUBQUERY5_t1 . * FROM X AS SUBQUERY5_t1 INNER JOIN ( T AS SUBQUERY5_t2 INNER JOIN DD AS SUBQUERY5_t3 ON (SUBQUERY5_t3 . col_varchar_64 = SUBQUERY5_t2 . col_varchar_key )) ON (SUBQUERY5_t3 . col_varchar_64 = SUBQUERY5_t2 . col_varchar_key ) WHERE ( SUBQUERY5_t2 . col_int_key >= SUBQUERY5_t2 . col_decimal_key AND SUBQUERY5_t3 . col_char_64_not_null <> SUBQUERY5_t2 . col_varchar_64_not_null ) ) AS table1 INNER JOIN O AS table2 ON (table2 . col_decimal_40_not_null_key = table1 . col_int_key ) WHERE table2 . col_decimal_30_10_not_null = SOME ( SELECT 8 FROM DUAL ) OR table2 . col_tinyint_not_null IN ( SELECT 0 FROM DUAL ) GROUP BY field1, field2, field3, field4 ;

[2023-03-21T12:59:44.591Z] Result:

[2023-03-21T12:59:44.591Z] ERROR 1105 (HY000) at line 1: probeWorker[0] meets error: runtime error: index out of range [8000] with length 1680

[2023-03-21T12:59:44.591Z] Expected:

[2023-03-21T12:59:44.591Z] +--------+--------+--------+--------+

[2023-03-21T12:59:44.591Z] | field1 | field2 | field3 | field4 |

[2023-03-21T12:59:44.591Z] +--------+--------+--------+--------+

[2023-03-21T12:59:44.591Z] | 0 | 1 | 0 | 0 |

[2023-03-21T12:59:44.591Z] | 0 | 0 | 0 | 1 |

[2023-03-21T12:59:44.591Z] | 0 | 1 | 0 | 1 |

[2023-03-21T12:59:44.591Z] +--------+--------+--------+--------+

Internal ci address: https://ci.pingcap.net/blue/organizations/jenkins/tiflash_regression_test_daily/detail/tiflash_regression_test_daily/4078/pipeline/

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

PASS

3. What did you see instead (Required)

ERROR 1105 (HY000) at line 1: probeWorker[0] meets error: runtime error: index out of range [8000] with length 1680

4. What is your TiDB version? (Required)

tidb_version() | Release Version: v7.0.0
Edition: Community
Git Commit Hash: a4ab759
Git Branch: heads/refs/tags/v7.0.0
UTC Build Time: 2023-03-21 11:55:13
GoVersion: go1.20.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv

@jebter jebter added type/bug The issue is confirmed as a bug. sig/execution SIG execution severity/major labels Mar 22, 2023
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Mar 22, 2023
@windtalker
Copy link
Contributor

Should be a bug in TiDB's nullaware join

[2023/03/22 14:24:10.328 +08:00] [INFO] [conn.go:1151] ["command dispatched failed"] [conn=7920886164544815507] [connInfo="id:7920886164544815507, addr:172.16.4.99:57442 status:10, collation:utf8mb4_0900_ai_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="SELECT  ( table1 . col_char_64 , table1 . col_char_64_not_null )  IN ( SELECT   SUBQUERY1_t1 . col_char_64_not_null AS SUBQUERY1_field1 , count( SUBQUERY1_t1 . col_varchar_64_not_null ) AS SUBQUERY1_field2 FROM A AS SUBQUERY1_t1 INNER JOIN ( M AS SUBQUERY1_t2 LEFT  JOIN DD AS SUBQUERY1_t3 ON (SUBQUERY1_t3 . col_decimal_30_10_key = SUBQUERY1_t2 . col_decimal_40  )) ON (SUBQUERY1_t3 . col_char_64_not_null = SUBQUERY1_t2 . col_varchar_key  )  GROUP BY SUBQUERY1_field1  ) AS field1 ,  ( table1 . col_decimal_40_key , table1 . col_bigint_not_null ) NOT IN ( SELECT 3 , 2 UNION  SELECT 9, 2 ) AS field2 ,  ( 4, 8 )  IN ( SELECT   SUBQUERY3_t1 . col_tinyint_not_null AS SUBQUERY3_field1 , SUBQUERY3_t1 . col_tinyint_not_null AS SUBQUERY3_field2 FROM L AS SUBQUERY3_t1 LEFT OUTER JOIN ( L AS SUBQUERY3_t2 INNER JOIN CC AS SUBQUERY3_t3 ON (SUBQUERY3_t3 . col_decimal_key = SUBQUERY3_t2 . col_int_key  )) ON (SUBQUERY3_t3 . col_tinyint_not_null = SUBQUERY3_t2 . pk  )  GROUP BY SUBQUERY3_field1 , SUBQUERY3_field2  ) AS field3 ,  table1 . col_bigint_not_null = SOME ( SELECT 0 UNION  SELECT 2 ) AS field4 FROM (  SELECT   SUBQUERY5_t1 . * FROM X AS SUBQUERY5_t1 INNER JOIN ( T AS SUBQUERY5_t2 INNER JOIN DD AS SUBQUERY5_t3 ON (SUBQUERY5_t3 . col_varchar_64 = SUBQUERY5_t2 . col_varchar_key  )) ON (SUBQUERY5_t3 . col_varchar_64 = SUBQUERY5_t2 . col_varchar_key  ) WHERE ( SUBQUERY5_t2 . col_int_key >= SUBQUERY5_t2 . col_decimal_key AND SUBQUERY5_t3 . col_char_64_not_null <> SUBQUERY5_t2 . col_varchar_64_not_null ) ) AS table1 INNER JOIN O AS table2 ON (table2 . col_decimal_40_not_null_key = table1 . col_int_key  ) WHERE  table2 . col_decimal_30_10_not_null = SOME ( SELECT 8 FROM DUAL ) OR  table2 . col_tinyint_not_null  IN ( SELECT 0 FROM DUAL )  GROUP BY field1, field2, field3, field4"] [txn_mode=PESSIMISTIC] [timestamp=440262000709468161] [err="probeWorker[0] meets error: runtime error: index out of range [8000] with length 1680\ngithub.com/pingcap/tidb/executor.(*probeWorker).handleProbeWorkerPanic\n\t/root/xufei/code/tidb/executor/join.go:402\ngithub.com/pingcap/tidb/util.(*WaitGroupWrapper).RunWithRecover.func1.1\n\t/root/xufei/code/tidb/util/wait_group_wrapper.go:168\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:884\nruntime.goPanicIndex\n\t/usr/local/go/src/runtime/panic.go:113\ngithub.com/pingcap/tidb/util/chunk.(*Column).GetDecimal\n\t/root/xufei/code/tidb/util/chunk/column.go:572\ngithub.com/pingcap/tidb/util/chunk.Row.GetMyDecimal\n\t/root/xufei/code/tidb/util/chunk/row.go:106\ngithub.com/pingcap/tidb/util/codec.encodeHashChunkRowIdx\n\t/root/xufei/code/tidb/util/codec/codec.go:354\ngithub.com/pingcap/tidb/util/codec.EqualChunkRow\n\t/root/xufei/code/tidb/util/codec/codec.go:710\ngithub.com/pingcap/tidb/executor.(*hashRowContainer).GetAllMatchedRows\n\t/root/xufei/code/tidb/executor/hash_table.go:203\ngithub.com/pingcap/tidb/executor.(*probeWorker).joinNAALOSJMatchProbeSideRow2Chunk\n\t/root/xufei/code/tidb/executor/join.go:683\ngithub.com/pingcap/tidb/executor.(*probeWorker).joinNAAJMatchProbeSideRow2Chunk\n\t/root/xufei/code/tidb/executor/join.go:903\ngithub.com/pingcap/tidb/executor.(*probeWorker).join2Chunk\n\t/root/xufei/code/tidb/executor/join.go:1023\ngithub.com/pingcap/tidb/executor.(*probeWorker).runJoinWorker\n\t/root/xufei/code/tidb/executor/join.go:508\ngithub.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndProbeHashTable.func2\n\t/root/xufei/code/tidb/executor/join.go:385\ngithub.com/pingcap/tidb/util.(*WaitGroupWrapper).RunWithRecover.func1\n\t/root/xufei/code/tidb/util/wait_group_wrapper.go:172\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1598"]

After disable nullaware join, the test can pass.

@windtalker windtalker added sig/planner SIG: Planner and removed sig/execution SIG execution labels Mar 22, 2023
@winoros winoros added affects-6.5 and removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-6.1 may-affects-6.5 labels Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants