-
Notifications
You must be signed in to change notification settings - Fork 131
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
add timeout for gs.GracefulStop #813
Conversation
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pkg/util/util.go
Outdated
exited := make(chan struct{}) | ||
go func() { | ||
defer func() { | ||
log.Info("goroutine exit bt itself (with GoAndAbortGoroutine help)", fName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does bt
mean?
pkg/util/util.go
Outdated
}() | ||
|
||
select { | ||
case <-time.After((timeout)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case <-time.After((timeout)): | |
case <-time.After(timeout): |
pkg/util/util.go
Outdated
@@ -280,3 +280,22 @@ func AdjustDuration(v *time.Duration, defValue time.Duration) { | |||
*v = defValue | |||
} | |||
} | |||
|
|||
// GoAndAbortGoroutine creates a goroutine to run fn, and then gives up waiting for the goroutine to exit When it timeouts | |||
func GoAndAbortGoroutine(name string, fn func(), timeout time.Duration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe WaitUntilTimeout
is a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/run-integration-tests tidb=release-3.0 |
cherry pick to release-3.0 in PR #817 |
cherry pick to release-2.1 failed |
cherry pick to release-3.1 in PR #824 |
What problem does this PR solve?
sometime pump would block at
gs.GracefulStop
when it exits, we still don't know the specific reason, but we don't need to wait for GRPC service exited, it's safe.What is changed and how it works?
add a timeout mechanism to give up waiting for the goroutine to exit
Check List
Tests