From 877b4fb2dcc2a87a775d0f9e760c0e7388c624c5 Mon Sep 17 00:00:00 2001 From: Alexander Peters Date: Thu, 3 Apr 2025 16:45:06 +0200 Subject: [PATCH] fix(cosmovisor): Fix consensus failure lottery (#24262) Co-authored-by: Alex | Interchain Labs Co-authored-by: Zygimantas --- tools/cosmovisor/CHANGELOG.md | 4 ++++ tools/cosmovisor/process.go | 2 +- .../cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index cf739974f7..b2c1d03872 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -40,6 +40,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#23720](https://github.com/cosmos/cosmos-sdk/pull/23720) Get block height from db after node execution fails +### Bug Fixes + +* [#23683](https://github.com/cosmos/cosmos-sdk/pull/23683) Replace `SigInt` with `SigTerm` to gracefully shutdown the process. + ## v1.7.1 - 2025-01-12 ### Bug Fixes diff --git a/tools/cosmovisor/process.go b/tools/cosmovisor/process.go index 4047193693..893683dbeb 100644 --- a/tools/cosmovisor/process.go +++ b/tools/cosmovisor/process.go @@ -283,7 +283,7 @@ func (l Launcher) WaitForUpgradeOrExit(cmd *exec.Cmd) (bool, error) { if l.cfg.ShutdownGrace > 0 { // Interrupt signal l.logger.Info("sent interrupt to app, waiting for exit") - _ = cmd.Process.Signal(os.Interrupt) + _ = cmd.Process.Signal(syscall.SIGTERM) // Wait app exit psChan := make(chan *os.ProcessState) diff --git a/tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd b/tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd index 8694ec8e8e..16f1ed2f74 100755 --- a/tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd +++ b/tools/cosmovisor/testdata/dontdie/cosmovisor/genesis/bin/dummyd @@ -5,7 +5,7 @@ warn() { echo "WARN Need Flush" } -trap warn INT +trap warn TERM echo Genesis $@ sleep 1 test -z $4 && exit 1001