improve-election-failover-on-process-termination#26
Open
gaozongjian wants to merge 1 commit intoLINBIT:masterfrom
Open
improve-election-failover-on-process-termination#26gaozongjian wants to merge 1 commit intoLINBIT:masterfrom
gaozongjian wants to merge 1 commit intoLINBIT:masterfrom
Conversation
Member
JoelColledge
left a comment
There was a problem hiding this comment.
Thanks for the contribution.
| // release before exit. Without this, SIGTERM terminates the process before | ||
| // cancel() is ever called, forcing followers to wait LeaseDuration to take over. | ||
| sigCh := make(chan os.Signal, 1) | ||
| signal.Notify(sigCh, syscall.SIGTERM, syscall.SIGINT) |
Member
There was a problem hiding this comment.
Couldn't we use signal.NotifyContext to implement this more simply?
| select { | ||
| case sig := <-sigCh: | ||
| log.Infof("received signal %v, releasing leader lease before exit", sig) | ||
| return fmt.Errorf("received signal: %v", sig) |
Member
There was a problem hiding this comment.
Regardless of whether we switch to signal.NotifyContext, I believe this is likely to be ineffective: When a signal is received, we return here and exit the process without waiting for the elector goroutine to respond to the context cancellation and give up the lease. This is an existing bug, but it is more relevant with this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handle OS signals: