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

Fixed deadlock that happens due to timeout #9007

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions worker/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ func (n *node) proposeAndWait(ctx context.Context, proposal *pb.Proposal) (perr
defer stop()

propose := func(timeout time.Duration) error {
cctx, cancel := context.WithCancel(ctx)
// We don't need to extend from base ctx as it might have a timeout. This timeout
// is only to find the proposal back via Raft.
cctx, cancel := context.WithCancel(context.Background())
defer cancel()

errCh := make(chan error, 1)
Expand All @@ -248,8 +250,6 @@ func (n *node) proposeAndWait(ctx context.Context, proposal *pb.Proposal) (perr
case err = <-errCh:
// We arrived here by a call to n.Proposals.Done().
return err
case <-ctx.Done():
return ctx.Err()
case <-timer.C:
if atomic.LoadUint32(&pctx.Found) > 0 {
// We found the proposal in CommittedEntries. No need to retry.
Expand Down