From 3bd52dc116e7d8785860ffc9a664165d5e664b9f Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Mon, 11 Jun 2018 23:46:53 -0500 Subject: [PATCH] sharding: address comments Former-commit-id: 79d9091f883f99d819cb73a862e4925cea309931 [formerly 0307849b5b99bd4d08fbd4a9986b729640bf2319] Former-commit-id: f950a1554d82d54ce981ce22c4e5639093428c56 --- sharding/node/backend.go | 12 ++++++------ sharding/observer/service.go | 3 +-- sharding/p2p/service.go | 3 +-- sharding/txpool/service.go | 3 +-- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/sharding/node/backend.go b/sharding/node/backend.go index b4bc98448..cfb459f27 100644 --- a/sharding/node/backend.go +++ b/sharding/node/backend.go @@ -12,6 +12,7 @@ import ( "sync" "syscall" + "github.com/ethereum/go-ethereum/internal/debug" "github.com/ethereum/go-ethereum/sharding/notary" "github.com/ethereum/go-ethereum/sharding/observer" shardp2p "github.com/ethereum/go-ethereum/sharding/p2p" @@ -110,12 +111,9 @@ func (s *ShardEthereum) Start() { log.Info("Starting sharding node") - for kind, service := range s.services { + for _, service := range s.services { // Start the next service. - if err := service.Start(); err != nil { - log.Error(fmt.Sprintf("Could not start service: %v, %v", kind, err)) - s.Close() - } + service.Start() } go func() { @@ -131,6 +129,9 @@ func (s *ShardEthereum) Start() { log.Warn("Already shutting down, interrupt more to panic.", "times", i-1) } } + // ensure trace and CPU profile data is flushed. + debug.Exit() + debug.LoudPanic("boom") }() // hang forever... @@ -145,7 +146,6 @@ func (s *ShardEthereum) Close() { } } log.Info("Stopping sharding node") - os.Exit(1) } // SMCClient returns an instance of a client that communicates to a mainchain node via diff --git a/sharding/observer/service.go b/sharding/observer/service.go index 21b2c8264..46b4bad50 100644 --- a/sharding/observer/service.go +++ b/sharding/observer/service.go @@ -22,9 +22,8 @@ func NewObserver(shardp2p sharding.ShardP2P, shardChainDb ethdb.Database) (*Obse } // Start the main routine for an observer. -func (o *Observer) Start() error { +func (o *Observer) Start() { log.Info("Starting shard observer service") - return nil } // Stop the main loop for observing the shard network. diff --git a/sharding/p2p/service.go b/sharding/p2p/service.go index 5972b0455..e9bc0505c 100644 --- a/sharding/p2p/service.go +++ b/sharding/p2p/service.go @@ -14,9 +14,8 @@ func NewServer() (*Server, error) { } // Start the main routine for an shardp2p server. -func (s *Server) Start() error { +func (s *Server) Start() { log.Info("Starting shardp2p server") - return nil } // Stop the main shardp2p loop.. diff --git a/sharding/txpool/service.go b/sharding/txpool/service.go index bc432bf02..7109c12d0 100644 --- a/sharding/txpool/service.go +++ b/sharding/txpool/service.go @@ -17,9 +17,8 @@ func NewShardTXPool(p2p sharding.ShardP2P) (*ShardTXPool, error) { } // Start the main routine for a shard transaction pool. -func (p *ShardTXPool) Start() error { +func (p *ShardTXPool) Start() { log.Info("Starting shard txpool service") - return nil } // Stop the main loop for a transaction pool in the shard network.