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(consensus): node stalled after client has stopped #1001

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion abci/client/socket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ type socketClient struct {

var _ Client = (*socketClient)(nil)

var (
ErrClientStopped = errors.New("client has stopped")
)

// NewSocketClient creates a new socket client, which connects to a given
// address. If mustConnect is true, the client will return an error upon start
// if it fails to connect.
Expand Down Expand Up @@ -234,7 +238,7 @@ func (cli *socketClient) didRecvResponse(res *types.Response) error {

func (cli *socketClient) doRequest(ctx context.Context, req *types.Request) (*types.Response, error) {
if !cli.IsRunning() {
return nil, errors.New("client has stopped")
return nil, ErrClientStopped
}

reqres := makeReqRes(ctx, req)
Expand Down
6 changes: 6 additions & 0 deletions internal/consensus/state_try_add_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package consensus

import (
"context"
"errors"
"fmt"

abciclient "github.com/dashpay/tenderdash/abci/client"
"github.com/dashpay/tenderdash/dash"
cstypes "github.com/dashpay/tenderdash/internal/consensus/types"
"github.com/dashpay/tenderdash/libs/log"
Expand Down Expand Up @@ -108,6 +110,10 @@ func (cs *TryAddCommitAction) verifyCommit(ctx context.Context, stateData *State
// We have a correct block, let's process it before applying the commit
err = cs.blockExec.ensureProcess(ctx, &stateData.RoundState, commit.Round)
if err != nil {
if errors.Is(err, abciclient.ErrClientStopped) {
// this is a non-recoverable error in current architecture
panic(fmt.Errorf("ABCI client stopped, Tenderdash needs to be restarted: %w", err))
}
lklimek marked this conversation as resolved.
Show resolved Hide resolved
return false, fmt.Errorf("unable to process proposal: %w", err)
}
err = cs.blockExec.validate(ctx, stateData)
Expand Down
Loading