From 94006855d14f3895d1777982de7ef08e9853fa11 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sat, 14 Jul 2018 13:29:54 +0100 Subject: [PATCH 1/3] changelog and version --- CHANGELOG.md | 17 +++++++++++++---- version/version.go | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c97b962af..19a431379 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,25 @@ # Changelog -## TBD +## 0.22.4 + +*July 14th, 2018* + +FEATURES: +- [tools] Merged in from github.com/tendermint/tools IMPROVEMENTS: - [genesis] removed deprecated `app_options` field. - [types] Genesis.AppStateJSON -> Genesis.AppState +BUG FIXES: +- [tools/tm-bench] Various fixes +- [consensus] Wait for WAL to stop on shutdown +- [abci] Fix #1891, pending requests cannot hang when abci server dies. Previously a crash in BeginBlock could leave tendermint in broken state. + ## 0.22.3 +*July 10th, 2018* + IMPROVEMENTS - Update dependencies * pin all values in Gopkg.toml to version or commit @@ -29,7 +41,6 @@ BUG FIXES - NOTE: this is only for URI requests. JSONRPC requests and all responses will use quoted integers (the proto3 JSON standard). - [consensus] Fix halt on shutdown -- [tm_bench] Fix method of computing start time, and end time ## 0.22.1 @@ -46,8 +57,6 @@ BUG FIXES already in the validator set. * [consensus] Shut down WAL properly. -BUG FIXES: -- [abci] Fix #1891, pending requests cannot hang when abci server dies. Previously a crash in BeginBlock could leave tendermint in broken state. ## 0.22.0 diff --git a/version/version.go b/version/version.go index 4e677b5f4..165f25829 100644 --- a/version/version.go +++ b/version/version.go @@ -4,13 +4,13 @@ package version const ( Maj = "0" Min = "22" - Fix = "3" + Fix = "4" ) var ( // Version is the current version of Tendermint // Must be a string because scripts like dist.sh read this file. - Version = "0.22.3" + Version = "0.22.4" // GitCommit is the current HEAD set using ldflags. GitCommit string From 74106c8bea9e3f83d867b04c879c1e86c8909004 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sat, 14 Jul 2018 14:05:50 +0100 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19a431379..fc42e7746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,13 @@ *July 14th, 2018* -FEATURES: -- [tools] Merged in from github.com/tendermint/tools - -IMPROVEMENTS: +BREAKING CHANGES: - [genesis] removed deprecated `app_options` field. - [types] Genesis.AppStateJSON -> Genesis.AppState +FEATURES: +- [tools] Merged in from github.com/tendermint/tools + BUG FIXES: - [tools/tm-bench] Various fixes - [consensus] Wait for WAL to stop on shutdown From d9030570113d178e13fbbb8772cebf1e5e94fbc1 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sat, 14 Jul 2018 14:50:56 +0100 Subject: [PATCH 3/3] fix stopping pubsub --- libs/pubsub/pubsub.go | 8 ++++++++ node/node.go | 10 +++++++--- node/node_test.go | 10 ++++++++++ types/event_bus.go | 4 ++-- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/libs/pubsub/pubsub.go b/libs/pubsub/pubsub.go index 4280ca1ea..4c0d97e2f 100644 --- a/libs/pubsub/pubsub.go +++ b/libs/pubsub/pubsub.go @@ -163,6 +163,8 @@ func (s *Server) Subscribe(ctx context.Context, clientID string, query Query, ou return nil case <-ctx.Done(): return ctx.Err() + case <-s.Quit(): + return nil } } @@ -190,6 +192,8 @@ func (s *Server) Unsubscribe(ctx context.Context, clientID string, query Query) return nil case <-ctx.Done(): return ctx.Err() + case <-s.Quit(): + return nil } } @@ -211,6 +215,8 @@ func (s *Server) UnsubscribeAll(ctx context.Context, clientID string) error { return nil case <-ctx.Done(): return ctx.Err() + case <-s.Quit(): + return nil } } @@ -229,6 +235,8 @@ func (s *Server) PublishWithTags(ctx context.Context, msg interface{}, tags TagM return nil case <-ctx.Done(): return ctx.Err() + case <-s.Quit(): + return nil } } diff --git a/node/node.go b/node/node.go index 9f6428ec1..faf33d88a 100644 --- a/node/node.go +++ b/node/node.go @@ -486,9 +486,16 @@ func (n *Node) OnStop() { n.BaseService.OnStop() n.Logger.Info("Stopping Node") + + // first stop the non-reactor services + n.eventBus.Stop() + n.indexerService.Stop() + + // now stop the reactors // TODO: gracefully disconnect from peers. n.sw.Stop() + // finally stop the listeners / external services for _, l := range n.rpcListeners { n.Logger.Info("Closing rpc listener", "listener", l) if err := l.Close(); err != nil { @@ -496,9 +503,6 @@ func (n *Node) OnStop() { } } - n.eventBus.Stop() - n.indexerService.Stop() - if pvsc, ok := n.privValidator.(*privval.SocketPV); ok { if err := pvsc.Stop(); err != nil { n.Logger.Error("Error stopping priv validator socket client", "err", err) diff --git a/node/node_test.go b/node/node_test.go index 80f6f02c2..ca074e1bc 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -2,6 +2,9 @@ package node import ( "context" + "fmt" + "os" + "syscall" "testing" "time" @@ -43,6 +46,13 @@ func TestNodeStartStop(t *testing.T) { select { case <-n.Quit(): case <-time.After(5 * time.Second): + pid := os.Getpid() + p, err := os.FindProcess(pid) + if err != nil { + panic(err) + } + err = p.Signal(syscall.SIGABRT) + fmt.Println(err) t.Fatal("timed out waiting for shutdown") } } diff --git a/types/event_bus.go b/types/event_bus.go index 54fc60c7b..b4965feee 100644 --- a/types/event_bus.go +++ b/types/event_bus.go @@ -4,9 +4,9 @@ import ( "context" "fmt" - tmpubsub "github.com/tendermint/tendermint/libs/pubsub" cmn "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/libs/log" + tmpubsub "github.com/tendermint/tendermint/libs/pubsub" ) const defaultCapacity = 0 @@ -49,7 +49,7 @@ func (b *EventBus) OnStart() error { } func (b *EventBus) OnStop() { - b.pubsub.OnStop() + b.pubsub.Stop() } func (b *EventBus) Subscribe(ctx context.Context, subscriber string, query tmpubsub.Query, out chan<- interface{}) error {