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

fix(bft): potential deadlock in the consensus ticker on close #2264

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tm2/pkg/bft/consensus/ticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ func (t *timeoutTicker) Chan() <-chan timeoutInfo {
// ScheduleTimeout schedules a new timeout by sending on the internal tickChan.
// The timeoutRoutine is always available to read from tickChan, so this won't block.
// The scheduling may fail if the timeoutRoutine has already scheduled a timeout for a later height/round/step.
// If the service has been closed, the timeout will be ignored.
func (t *timeoutTicker) ScheduleTimeout(ti timeoutInfo) {
t.tickChan <- ti
select {
case t.tickChan <- ti:
case <-t.Quit():
t.Logger.Warn("Unable to schedule timeout as service has been closed")
}
}

// -------------------------------------------------------------
Expand Down
Loading