From b5cadff2c3009db450b44f175ea90e2c962a2785 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 4 Aug 2021 17:44:37 +0300 Subject: [PATCH] [#745] node: Add more debug logs on shutdown Signed-off-by: Pavel Karpy --- cmd/neofs-node/grpc.go | 8 ++++++++ cmd/neofs-node/main.go | 2 ++ cmd/neofs-node/metrics.go | 4 ++++ cmd/neofs-node/pprof.go | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/cmd/neofs-node/grpc.go b/cmd/neofs-node/grpc.go index a93ae222c..576f58b13 100644 --- a/cmd/neofs-node/grpc.go +++ b/cmd/neofs-node/grpc.go @@ -50,9 +50,17 @@ func serveGRPC(c *cfg) { go func() { defer func() { + c.log.Info("stop listening gRPC endpoint", + zap.String("endpoint", lis.Addr().String()), + ) + c.wg.Done() }() + c.log.Info("start listening gRPC endpoint", + zap.String("endpoint", lis.Addr().String()), + ) + if err := srv.Serve(lis); err != nil { fmt.Println("gRPC server error", err) } diff --git a/cmd/neofs-node/main.go b/cmd/neofs-node/main.go index 6ec40e43b..4be7b62c0 100644 --- a/cmd/neofs-node/main.go +++ b/cmd/neofs-node/main.go @@ -117,6 +117,8 @@ func shutdown(c *cfg) { closer() } + c.log.Debug("waiting for all processes to stop") + c.wg.Wait() } diff --git a/cmd/neofs-node/metrics.go b/cmd/neofs-node/metrics.go index 4617d1915..d837dc9c7 100644 --- a/cmd/neofs-node/metrics.go +++ b/cmd/neofs-node/metrics.go @@ -31,11 +31,15 @@ func initMetrics(c *cfg) { })) c.closers = append(c.closers, func() { + c.log.Debug("shutting down metrics service") + err := srv.Shutdown() if err != nil { c.log.Debug("could not shutdown metrics server", zap.String("error", err.Error()), ) } + + c.log.Debug("metrics service has been stopped") }) } diff --git a/cmd/neofs-node/pprof.go b/cmd/neofs-node/pprof.go index dc6f74b16..5332fafbe 100644 --- a/cmd/neofs-node/pprof.go +++ b/cmd/neofs-node/pprof.go @@ -30,11 +30,15 @@ func initProfiler(c *cfg) { })) c.closers = append(c.closers, func() { + c.log.Debug("shutting down profiling service") + err := srv.Shutdown() if err != nil { c.log.Debug("could not shutdown pprof server", zap.String("error", err.Error()), ) } + + c.log.Debug("profiling service has been stopped") }) }