executor: fix hashjoin goleak#39023
Conversation
Signed-off-by: xhe <xw897002528@gmail.com>
|
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by submitting an approval review. |
| // closeCh add a lock for closing executor. | ||
| closeCh chan struct{} | ||
| worker util.WaitGroupWrapper | ||
| waiter util.WaitGroupWrapper |
There was a problem hiding this comment.
waitJoinWorkersAndCloseResultChan will call worker.Wait(), but it is running in another goroutine. So waiter is to prevent leak of waitJoinWorkersAndCloseResultChan.
| defer func() { | ||
| r := recover() | ||
| if r != nil && recoverFn != nil { | ||
| if recoverFn != nil { |
There was a problem hiding this comment.
util.WithRecovery will always call recoveryFn, align with it and hashjoin relies on this behavior.
| if val.(bool) { | ||
| err = errors.Errorf("issue30289 build return error") | ||
| e.buildFinished <- errors.Trace(err) | ||
| errCh <- errors.Trace(err) |
There was a problem hiding this comment.
fetchBuildSideRows and fetchAndBuildHashTable are running in parallel. So fetchAndBuildHashTable may close buildFinished before fetchBuildSideRows is finised.
Signed-off-by: xhe <xw897002528@gmail.com>
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: 2fdb71a |
|
In response to a cherrypick label: new pull request created: #39054. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
In response to a cherrypick label: new pull request created: #39055. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
In response to a cherrypick label: cannot checkout |
|
In response to a cherrypick label: new pull request created: #39056. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
In response to a cherrypick label: new pull request created: #39057. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
In response to a cherrypick label: new pull request created: #39058. |
TiDB MergeCI notify✅ Well Done! New fixed [1] after this pr merged.
|
Signed-off-by: xhe xw897002528@gmail.com
What problem does this PR solve?
Issue Number: close #39026
Problem Summary:
fetchAndBuildHashTableleaked even afterrs.Close().What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.