Skip to content

Commit

Permalink
feat: make abci handshake graceful interruptable
Browse files Browse the repository at this point in the history
long running abci handshake can be used to profile block execution,
but we need to make graceful shutdown works with it.
  • Loading branch information
yihuang committed Jun 27, 2023
1 parent e334ec3 commit 7234bb3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (all) [#16537](https://github.com/cosmos/cosmos-sdk/pull/16537) Properly propagated fmt.Errorf errors + using errors.New where appropriate.
* (all) [#16497](https://github.com/cosmos/cosmos-sdk/pull/16497) Removed all exported vestiges of `sdk.MustSortJSON` and `sdk.SortJSON`.
* (x/distribution) [#16218](https://github.com/cosmos/cosmos-sdk/pull/16218) Add Autocli config to distribution module.
* (cli) [#16206](https://github.com/cosmos/cosmos-sdk/pull/16206) Make ABCI handshake profileable.

### API Breaking Changes

Expand Down
10 changes: 6 additions & 4 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,15 @@ func startInProcess(svrCtx *Context, svrCfg serverconfig.Config, clientCtx clien

gRPCOnly := svrCtx.Viper.GetBool(flagGRPCOnly)

g, ctx := getCtx(svrCtx, true)

if gRPCOnly {
// TODO: Generalize logic so that gRPC only is really in startStandAlone
svrCtx.Logger.Info("starting node in gRPC only mode; CometBFT is disabled")
svrCfg.GRPC.Enable = true
} else {
svrCtx.Logger.Info("starting node with ABCI CometBFT in-process")
tmNode, cleanupFn, err := startCmtNode(cmtCfg, app, svrCtx)
tmNode, cleanupFn, err := startCmtNode(ctx, cmtCfg, app, svrCtx)
if err != nil {
return err
}
Expand All @@ -315,8 +317,6 @@ func startInProcess(svrCtx *Context, svrCfg serverconfig.Config, clientCtx clien
}
}

g, ctx := getCtx(svrCtx, true)

grpcSrv, clientCtx, err := startGrpcServer(ctx, g, svrCfg.GRPC, clientCtx, svrCtx, app)
if err != nil {
return err
Expand All @@ -340,6 +340,7 @@ func startInProcess(svrCtx *Context, svrCfg serverconfig.Config, clientCtx clien

// TODO: Move nodeKey into being created within the function.
func startCmtNode(
ctx context.Context,
cfg *cmtcfg.Config,
app types.Application,
svrCtx *Context,
Expand All @@ -350,7 +351,8 @@ func startCmtNode(
}

cmtApp := NewCometABCIWrapper(app)
tmNode, err = node.NewNode(
tmNode, err = node.NewNodeWithContext(
ctx,
cfg,
pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile()),
nodeKey,
Expand Down

0 comments on commit 7234bb3

Please sign in to comment.