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 crashes when sql with shuffleExec exceed tidb_mem_quota_query #48230

Closed
wshwsh12 opened this issue Nov 2, 2023 · 0 comments · Fixed by #48828
Closed

Tidb crashes when sql with shuffleExec exceed tidb_mem_quota_query #48230

wshwsh12 opened this issue Nov 2, 2023 · 0 comments · Fixed by #48828
Labels
affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 severity/major sig/execution SIG execution type/bug This issue is a bug.

Comments

@wshwsh12
Copy link
Contributor

wshwsh12 commented Nov 2, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use test;
drop table if exists t1;
create table t1(i int, j int, k int);
insert into t1 VALUES (1,1,1),(2,2,2),(3,3,3),(4,4,4);
INSERT INTO t1 SELECT 10*i,j,5*j FROM t1 UNION SELECT 20*i,j,5*j FROM t1 UNION SELECT 30*i,j,5*j FROM t1;
INSERT INTO t1 SELECT 10*i,j,5*j FROM t1 UNION SELECT 20*i,j,5*j FROM t1 UNION SELECT 30*i,j,5*j FROM t1;
INSERT INTO t1 SELECT 10*i,j,5*j FROM t1 UNION SELECT 20*i,j,5*j FROM t1 UNION SELECT 30*i,j,5*j FROM t1;
set @@session.tidb_enable_window_function=1;
set tidb_window_concurrency = 128;
set tidb_mem_quota_query = 13000;

run the sql many times(more than 100000 times):
SELECT SUM(i) OVER W FROM t1 WINDOW w AS (PARTITION BY j ORDER BY i) ORDER BY 1+SUM(i) OVER w;

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

3. What did you see instead (Required)

TiDB crashes.

panic: send on closed channel [recovered]
	panic: send on closed channel

goroutine 108646 [running]:
github.com/pingcap/tidb/pkg/executor.recoveryShuffleExec(0x62f14f0?, {0x52bf360, 0x62acbf0})
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/shuffle.go:259 +0x199
github.com/pingcap/tidb/pkg/executor.(*ShuffleExec).fetchDataAndSplit.func1()
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/shuffle.go:273 +0x4d
panic({0x52bf360?, 0x62acbf0?})
	/usr/local/go/src/runtime/panic.go:914 +0x21f
github.com/pingcap/tidb/pkg/executor.(*ShuffleExec).fetchDataAndSplit(0xc005cf4d20, {0x62f14f0, 0xc00763fb00}, 0x0)
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/shuffle.go:283 +0x44c
created by github.com/pingcap/tidb/pkg/executor.(*ShuffleExec).prepare4ParallelExec in goroutine 20378
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/executor/shuffle.go:208 +0x48

4. What is your TiDB version? (Required)

nightly-20231101

@wshwsh12 wshwsh12 added the type/bug This issue is a bug. label Nov 2, 2023
@ti-chi-bot ti-chi-bot bot added 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 may-affects-7.1 may-affects-7.5 labels Nov 6, 2023
@wshwsh12 wshwsh12 added affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 labels Nov 23, 2023
@ti-chi-bot ti-chi-bot bot removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 labels Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 severity/major sig/execution SIG execution type/bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants