From c405721b3f62d63547745d2a96ba32577070f5fe Mon Sep 17 00:00:00 2001 From: mmsqe Date: Thu, 29 Sep 2022 23:33:28 +0800 Subject: [PATCH 1/2] fix: add close for grpcOnly mode (#13418) (cherry picked from commit bed4ba3ac83413c63c002fcd1d5e72f6199c4bc1) # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 16 ++++++++++++++++ server/start.go | 18 +++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17dca0370ada..1615870c007c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,9 +64,25 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (types) [#13265](https://github.com/cosmos/cosmos-sdk/pull/13265) Correctly coalesce coins even with repeated denominations & simplify logic * (x/auth) [#13200](https://github.com/cosmos/cosmos-sdk/pull/13200) Fix wrong sequences in `sign-batch`. * (export) [#13029](https://github.com/cosmos/cosmos-sdk/pull/13029) Fix exporting the blockParams regression. +<<<<<<< HEAD * [#13046](https://github.com/cosmos/cosmos-sdk/pull/13046) Fix missing return statement in BaseApp.Query. * (store) [#13336](https://github.com/cosmos/cosmos-sdk/pull/13336) Call streaming listeners for deliver tx event, it was removed accidentally, backport #13334. * (grpc) [#13417](https://github.com/cosmos/cosmos-sdk/pull/13417) fix grpc query panic that could crash the node (backport #13352). +======= +* (x/gov) [#13051](https://github.com/cosmos/cosmos-sdk/pull/13051) In SubmitPropsal, when a legacy msg fails it's handler call, wrap the error as ErrInvalidProposalContent (instead of ErrNoProposalHandlerExists). +* (x/gov) [#13045](https://github.com/cosmos/cosmos-sdk/pull/13045) Fix gov migrations for v3(0.46). +* (Store) [#13334](https://github.com/cosmos/cosmos-sdk/pull/13334) Call streaming listeners for deliver tx event, it was removed accidentally. +* (grpc) [#13352](https://github.com/cosmos/cosmos-sdk/pull/13352) fix grpc query panic that could crash the node. +* (snapshot) [#13400](https://github.com/cosmos/cosmos-sdk/pull/13400) Fix snapshot checksum issue in golang 1.19. +* (grpc) [#13418](https://github.com/cosmos/cosmos-sdk/pull/13418) Add close for grpc only mode. + +### Deprecated + +* (x/bank) [#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) The Params.SendEnabled field is deprecated and unusable. + The information can now be accessed using the BankKeeper. + Setting can be done using MsgSetSendEnabled as a governance proposal. + A SendEnabled query has been added to both GRPC and CLI. +>>>>>>> bed4ba3ac (fix: add close for grpcOnly mode (#13418)) ## [v0.46.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.1) - 2022-08-24 diff --git a/server/start.go b/server/start.go index 722a77809a7e..68f40dcfea08 100644 --- a/server/start.go +++ b/server/start.go @@ -417,13 +417,18 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App if err != nil { return err } - + defer grpcSrv.Stop() if config.GRPCWeb.Enable { grpcWebSrv, err = servergrpc.StartGRPCWeb(grpcSrv, config) if err != nil { ctx.Logger.Error("failed to start grpc-web http server: ", err) return err } + defer func() { + if err := grpcWebSrv.Close(); err != nil { + ctx.Logger.Error("failed to close grpc-web http server: ", err) + } + }() } } @@ -486,7 +491,7 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App } defer func() { - if tmNode.IsRunning() { + if tmNode != nil && tmNode.IsRunning() { _ = tmNode.Stop() } @@ -498,15 +503,6 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App _ = apiSrv.Close() } - if grpcSrv != nil { - grpcSrv.Stop() - if grpcWebSrv != nil { - if err := grpcWebSrv.Close(); err != nil { - ctx.Logger.Error("failed to close grpc-web http server: ", err) - } - } - } - ctx.Logger.Info("exiting...") }() From 9a2147bccf1d9ff44db9ad62fe9ca660a21705da Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 29 Sep 2022 21:35:09 +0200 Subject: [PATCH 2/2] fix conflicts --- CHANGELOG.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1615870c007c..2c057767dc09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,26 +64,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (types) [#13265](https://github.com/cosmos/cosmos-sdk/pull/13265) Correctly coalesce coins even with repeated denominations & simplify logic * (x/auth) [#13200](https://github.com/cosmos/cosmos-sdk/pull/13200) Fix wrong sequences in `sign-batch`. * (export) [#13029](https://github.com/cosmos/cosmos-sdk/pull/13029) Fix exporting the blockParams regression. -<<<<<<< HEAD * [#13046](https://github.com/cosmos/cosmos-sdk/pull/13046) Fix missing return statement in BaseApp.Query. * (store) [#13336](https://github.com/cosmos/cosmos-sdk/pull/13336) Call streaming listeners for deliver tx event, it was removed accidentally, backport #13334. * (grpc) [#13417](https://github.com/cosmos/cosmos-sdk/pull/13417) fix grpc query panic that could crash the node (backport #13352). -======= -* (x/gov) [#13051](https://github.com/cosmos/cosmos-sdk/pull/13051) In SubmitPropsal, when a legacy msg fails it's handler call, wrap the error as ErrInvalidProposalContent (instead of ErrNoProposalHandlerExists). -* (x/gov) [#13045](https://github.com/cosmos/cosmos-sdk/pull/13045) Fix gov migrations for v3(0.46). -* (Store) [#13334](https://github.com/cosmos/cosmos-sdk/pull/13334) Call streaming listeners for deliver tx event, it was removed accidentally. -* (grpc) [#13352](https://github.com/cosmos/cosmos-sdk/pull/13352) fix grpc query panic that could crash the node. -* (snapshot) [#13400](https://github.com/cosmos/cosmos-sdk/pull/13400) Fix snapshot checksum issue in golang 1.19. * (grpc) [#13418](https://github.com/cosmos/cosmos-sdk/pull/13418) Add close for grpc only mode. -### Deprecated - -* (x/bank) [#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) The Params.SendEnabled field is deprecated and unusable. - The information can now be accessed using the BankKeeper. - Setting can be done using MsgSetSendEnabled as a governance proposal. - A SendEnabled query has been added to both GRPC and CLI. ->>>>>>> bed4ba3ac (fix: add close for grpcOnly mode (#13418)) - ## [v0.46.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.1) - 2022-08-24 ### Improvements