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

IndexNestedLoopHashJoin send on closed channel #31129

Closed
ichn-hu opened this issue Dec 29, 2021 · 2 comments · Fixed by #31323
Closed

IndexNestedLoopHashJoin send on closed channel #31129

ichn-hu opened this issue Dec 29, 2021 · 2 comments · Fixed by #31323
Assignees
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. component/executor severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@ichn-hu
Copy link
Contributor

ichn-hu commented Dec 29, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

the reproduce can be done by #31128

checkout the code and run

make failpoint-enable
cd executor
go test -check.f TestIndexNestedLoopHashJoin > test.result

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

no panic

3. What did you see instead (Required)

[2021/12/29 16:32:57.687 +08:00] [ERROR] [misc.go:94] ["panic in the recoverable goroutine"] [r="\"send on closed channel\""] ["stack trace"="github.com/pingcap/tidb/util.WithRecovery.func1\n\t/home/ichn/Projects/pingcap/tidb/util/misc.go:96\nruntime.gopanic\n\t/home/ichn/.gvm/gos/go1.16/src/runtime/panic.go:965\nruntime.chansend\n\t/home/ichn/.gvm/gos/go1.16/src/runtime/chan.go:204\nruntime.chansend1\n\t/home/ichn/.gvm/gos/go1.16/src/runtime/chan.go:143\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).run\n\t/home/ichn/Projects/pingcap/tidb/executor/index_lookup_hash_join.go:503\ngithub.com/pingcap/tidb/executor.(*IndexNestedLoopHashJoin).startWorkers.func2\n\t/home/ichn/Projects/pingcap/tidb/executor/index_lookup_hash_join.go:196\ngithub.com/pingcap/tidb/util.WithRecovery\n\t/home/ichn/Projects/pingcap/tidb/util/misc.go:99"]

the reason for this panic is because if the result needs to be ordered and it got any error during doJoinInOrder

image

the resultCh will be closed

however in indexHashJoinInnerWorker

image

the returned error will be sent to the resultCh which is already closed, causing the panic.

4. What is your TiDB version? (Required)

master

@ichn-hu ichn-hu added type/bug The issue is confirmed as a bug. component/executor sig/execution SIG execution severity/major affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. labels Dec 29, 2021
@yudongusa
Copy link

yudongusa commented Jan 3, 2022

@XuHuaiyu assign this to you for now.

@github-actions
Copy link

github-actions bot commented Jan 7, 2022

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

ti-chi-bot pushed a commit that referenced this issue Jan 7, 2022
XuHuaiyu added a commit to ti-srebot/tidb that referenced this issue Feb 9, 2022
ti-chi-bot pushed a commit that referenced this issue Feb 9, 2022
XuHuaiyu pushed a commit to ti-srebot/tidb that referenced this issue Feb 22, 2022
ti-chi-bot pushed a commit that referenced this issue Feb 22, 2022
XuHuaiyu added a commit to ti-srebot/tidb that referenced this issue Apr 13, 2022
ti-chi-bot pushed a commit that referenced this issue Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. component/executor severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
3 participants