diff --git a/cmd/tendermint/commands/inspect.go b/cmd/tendermint/commands/inspect.go index 3cf33630b..73d0280ca 100644 --- a/cmd/tendermint/commands/inspect.go +++ b/cmd/tendermint/commands/inspect.go @@ -55,6 +55,9 @@ func runInspect(cmd *cobra.Command, args []string) error { blockStore := store.NewBlockStore(blockStoreDB) stateDB, err := cfg.DefaultDBProvider(&cfg.DBContext{ID: "statestore", Config: config}) if err != nil { + if err := blockStoreDB.Close(); err != nil { + logger.Error("error closing block store db", "error", err) + } return err } genDoc, err := types.GenesisDocFromFile(config.GenesisFile()) @@ -71,7 +74,6 @@ func runInspect(cmd *cobra.Command, args []string) error { logger.Info("starting inspect server") if err := ins.Run(ctx); err != nil { - logger.Error("error encountered while running inspect server", "err", err) return err } return nil diff --git a/docs/tools/debugging/README.md b/docs/tools/debugging/README.md index c2677db45..053b43624 100644 --- a/docs/tools/debugging/README.md +++ b/docs/tools/debugging/README.md @@ -63,7 +63,7 @@ given destination directory. Each archive will contain: Note: goroutine.out and heap.out will only be written if a profile address is provided and is operational. This command is blocking and will log any error. -## Tendermint inspect +## Tendermint Inspect Tendermint includes an `inspect` command for querying Tendermint's state store and block store over Tendermint RPC. diff --git a/docs/tools/debugging/pro.md b/docs/tools/debugging/pro.md index 7dfa8a381..b43ed5cba 100644 --- a/docs/tools/debugging/pro.md +++ b/docs/tools/debugging/pro.md @@ -64,7 +64,7 @@ It won’t kill the node, but it will gather all of the above data and package i At this point, depending on how severe the degradation is, you may want to restart the process. -## Tendermint inspect +## Tendermint Inspect What if the Tendermint node will not start up due to inconsistent consensus state? diff --git a/inspect/inspect.go b/inspect/inspect.go index 57b10c092..713f72720 100644 --- a/inspect/inspect.go +++ b/inspect/inspect.go @@ -99,7 +99,7 @@ func (ins *Inspect) Run(ctx context.Context) error { return nil }) g.Go(func() error { - return startRPCServers(ctx, ins.config, ins.logger, ins.routes) + return startRPCServers(tctx, ins.config, ins.logger, ins.routes) }) <-tctx.Done() @@ -111,7 +111,7 @@ func (ins *Inspect) Run(ctx context.Context) error { } func startRPCServers(ctx context.Context, cfg *config.RPCConfig, logger log.Logger, routes rpccore.RoutesMap) error { - g, _ := errgroup.WithContext(ctx) + g, tctx := errgroup.WithContext(ctx) listenAddrs := tmstrings.SplitAndTrimEmpty(cfg.ListenAddress, ",", " ") rh := rpc.Handler(cfg, routes, logger) for _, listenerAddr := range listenAddrs { @@ -127,7 +127,7 @@ func startRPCServers(ctx context.Context, cfg *config.RPCConfig, logger log.Logg g.Go(func() error { logger.Info("RPC HTTPS server starting", "address", listenerAddr, "certfile", certFile, "keyfile", keyFile) - err := server.ListenAndServeTLS(ctx, certFile, keyFile) + err := server.ListenAndServeTLS(tctx, certFile, keyFile) if !errors.Is(err, net.ErrClosed) { logger.Error("RPC HTTPS server stopped with error", "address", listenerAddr, "err", err) return err @@ -138,7 +138,7 @@ func startRPCServers(ctx context.Context, cfg *config.RPCConfig, logger log.Logg } else { g.Go(func() error { logger.Info("RPC HTTP server starting", "address", listenerAddr) - err := server.ListenAndServe(ctx) + err := server.ListenAndServe(tctx) if !errors.Is(err, net.ErrClosed) { logger.Error("RPC HTTP server stopped with error", "address", listenerAddr, "err", err) return err diff --git a/node/node.go b/node/node.go index 4d57f7bab..cec117510 100644 --- a/node/node.go +++ b/node/node.go @@ -168,8 +168,9 @@ func makeNode(config *cfg.Config, } go func() { - if !errors.Is(ins.indexerService.Start(), pubsub.ErrUnsubscribed) { - return err + err := indexerService.Start() + if !errors.Is(err, pubsub.ErrUnsubscribed) { + logger.Error("error starting indexer service", "error", err) } }() diff --git a/state/indexer/indexer_service.go b/state/indexer/indexer_service.go index c1d006dce..1acfc9931 100644 --- a/state/indexer/indexer_service.go +++ b/state/indexer/indexer_service.go @@ -20,8 +20,6 @@ type Service struct { eventSinks []EventSink eventBus *types.EventBus - - doneChan chan struct{} } // NewIndexerService returns a new service instance. @@ -29,7 +27,6 @@ func NewIndexerService(es []EventSink, eventBus *types.EventBus) *Service { is := &Service{eventSinks: es, eventBus: eventBus} is.BaseService = *service.NewBaseService(nil, "IndexerService", is) - is.doneChan = make(chan struct{}) return is }