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

It raise panic when comparing int with double data type in associated subqueries #25802

Closed
lilinghai opened this issue Jun 28, 2021 · 4 comments
Assignees
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@lilinghai
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

1.txt
download and source the 1.txt file

select max( `col_tinyint_undef_unsigned` ) as x from table_25_latin1_undef as t1 having  exists (select `col_smallint_key_signed` from table_75_latin1_undef as t2 where x = t2. `col_double_key_unsigned`);

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

successfully

3. What did you see instead (Required)

[conn.go:736] ["connection running loop panic"] [conn=67] [lastSQL="select max( `col_tinyint_undef_unsigned` ) as x from table_25_latin1_undef as t1 having  exists (select `col_smallint_key_signed` from table_75_latin1_undef as t2 where x = t2. `col_double_key_unsigned`)"] [err="runtime error: index out of range [1] with length 1"] [stack="goroutine 1433974 [running]:
github.com/pingcap/tidb/server.(*clientConn).Run.func1(0x402c320, 0xc0a921a090, 0xc087490c00)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:734 +0xee
panic(0x37bcc80, 0xc185161d00)
\t/usr/local/go/src/runtime/panic.go:679 +0x1b2
github.com/pingcap/tidb/server.(*clientConn).writeResultset.func1(0xc14bd6f100, 0x402c320, 0xc18515e0f0, 0xc087490c00)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:1749 +0x4e2
panic(0x37bcc80, 0xc185161d00)
\t/usr/local/go/src/runtime/panic.go:679 +0x1b2
github.com/pingcap/tidb/executor.colNames2ResultFields(0xc185164c80, 0xc0050be858, 0x1, 0x1, 0xc0aaa42020, 0x3, 0x2dd06b6, 0x0, 0x0)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/adapter.go:97 +0x64f
github.com/pingcap/tidb/executor.(*recordSet).Fields(0xc1851b5180, 0xc1851b5180, 0xc000851100, 0xc14bd6eee8)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/adapter.go:88 +0xe0
github.com/pingcap/tidb/server.(*tidbResultSet).Columns(0xc1851b51d0, 0x402c320, 0xc18515e0f0, 0xc1851b5220)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/driver_tidb.go:346 +0xa8
github.com/pingcap/tidb/server.(*clientConn).writeChunks(0xc087490c00, 0x402c320, 0xc18515e0f0, 0x404caa0, 0xc1851b51d0, 0xc10002f000, 0x1e0e2a6, 0x369b340, 0x0)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:1822 +0x708
github.com/pingcap/tidb/server.(*clientConn).writeResultset(0xc087490c00, 0x402c320, 0xc18515e0f0, 0x404caa0, 0xc1851b51d0, 0x2ca00, 0x0, 0x0, 0x0, 0x0)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:1762 +0x201
github.com/pingcap/tidb/server.(*clientConn).handleStmt(0xc087490c00, 0x402c320, 0xc18515e0f0, 0x4052f80, 0xc127ce7300, 0x5fc9740, 0x0, 0x0, 0x1, 0x0, ...)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:1656 +0x242
github.com/pingcap/tidb/server.(*clientConn).handleQuery(0xc087490c00, 0x402c260, 0xc0049539c0, 0xc106c26a91, 0xcb, 0x0, 0x0)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:1503 +0x44f
github.com/pingcap/tidb/server.(*clientConn).dispatch(0xc087490c00, 0x402c260, 0xc0049539c0, 0xc106c26a90, 0xcc, 0xcb, 0x0, 0x0)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:1037 +0x6f2
github.com/pingcap/tidb/server.(*clientConn).Run(0xc087490c00, 0x402c320, 0xc0a921a090)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/conn.go:795 +0x293
github.com/pingcap/tidb/server.(*Server).onConn(0xc001774270, 0xc087490c00)
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/server.go:477 +0xb1b
created by github.com/pingcap/tidb/server.(*Server).Run
\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/server/server.go:380 +0x8a5
"]

4. What is your TiDB version? (Required)

Release Version: v5.0.3
Edition: Community
Git Commit Hash: ad06648
Git Branch: heads/refs/tags/v5.0.3
UTC Build Time: 2021-06-25 10:00:40
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@lzmhhh123
Copy link
Contributor

/assign @guo-shaoge

@guo-shaoge
Copy link
Collaborator

guo-shaoge commented Sep 23, 2021

#24862 fixed this problem. Will cherry pick to 5.0

@XuHuaiyu
Copy link
Contributor

As the above comment explained, this bug has been fixed.

I'll close this issue. Feel free to reopen it if you have any questions.

@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/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

5 participants