-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
index_hash_join hang when context canceled #54688
Labels
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-8.1
This bug affects the 8.1.x(LTS) versions.
report/customer
Customers have encountered this bug.
severity/major
sig/execution
SIG execution
type/bug
The issue is confirmed as a bug.
Comments
Code Analyze
joinMatchedInnerRow2Chunk
if joinResult.chk.IsFull() {
select {
case iw.resultCh <- joinResult: // <- send to resultCh the first time.
case <-ctx.Done():
}
failpoint.InjectCall("joinMatchedInnerRow2Chunk")
joinResult, ok = iw.getNewJoinResult(ctx)
if !ok {
return false, joinResult
}
}
func (iw *indexHashJoinInnerWorker) getNewJoinResult(ctx context.Context) (*indexHashJoinResult, bool) {
joinResult := &indexHashJoinResult{
src: iw.joinChkResourceCh,
}
ok := true
select { // <- random select a path
case joinResult.chk, ok = <-iw.joinChkResourceCh:
case <-ctx.Done(): // <- choose this path
return joinResult, false
}
return joinResult, ok
}
ok, joinResult = iw.joinMatchedInnerRow2Chunk(ctx, row, task, joinResult, h, iw.joinKeyBuf)
if !ok {
return joinResult.err // nil
}
select { //<-random select a path
case <-ctx.Done():
return
case task, ok = <-iw.taskCh: // <- choose this path
}
if !ok {
break // exit this loop
}
......
......
if resultCh == iw.resultCh {
if joinResult.err != nil {
resultCh <- joinResult
return
}
if joinResult.chk != nil && joinResult.chk.NumRows() > 0 {
select { // <- random select a path
case resultCh <- joinResult: // <- choose this path, send to resultCh the second time.
case <-ctx.Done():
return
}
}
}
|
jebter
added
sig/execution
SIG execution
severity/critical
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-8.1
This bug affects the 8.1.x(LTS) versions.
labels
Jul 18, 2024
ti-chi-bot
bot
added
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
labels
Jul 18, 2024
This issue can cause a single query to hang, but it won't result in a panic or similar problems. It is an intermittent issue and does not occur every time. I will change the severity label from critical to major. |
13 tasks
wshwsh12
added
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
labels
Jul 24, 2024
ti-chi-bot
bot
removed
may-affects-5.4
This bug maybe affects 5.4.x versions.
may-affects-6.1
labels
Jul 24, 2024
This was referenced Jul 29, 2024
/report customer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-8.1
This bug affects the 8.1.x(LTS) versions.
report/customer
Customers have encountered this bug.
severity/major
sig/execution
SIG execution
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Context canceled may occur at any time if the sql is interrupted during execution.
I try to inject context cancel to indexhashjoin, to reproduce the issue.
Patch this diff to index_lookup_join.go
Run the UT
2. What did you expect to see? (Required)
Can run successfully.
3. What did you see instead (Required)
Hang forever.
goroutine in master.
goroutine in v6.5.6
4. What is your TiDB version? (Required)
master, v6.5.6
The text was updated successfully, but these errors were encountered: