From d93a6a54b108dae5427b1e09abbf2f3e0e6128e7 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Thu, 22 Jan 2026 11:36:38 -0500 Subject: [PATCH] lndclient: silence expected error on shutdown During planned termination, conn.Close() can return ErrClientConnClosing from gRPC package. This is expected and should not be logged as an error. Downgrade that case to debug so logs stay clean during shutdown. Original log line: [ERR] LNDC: Error closing lnd connection: rpc error: code = Canceled desc = grpc: the client connection is closing --- lnd_services.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lnd_services.go b/lnd_services.go index ecb5268..c8558fb 100644 --- a/lnd_services.go +++ b/lnd_services.go @@ -332,7 +332,15 @@ func NewLndServices(cfg *LndServicesConfig) (*GrpcLndServices, error) { cleanupConn := func() { closeErr := conn.Close() - if closeErr != nil { + switch { + case closeErr == nil: + // No error. + + case errors.Is(closeErr, grpc.ErrClientConnClosing): + log.Debugf("LND connection is already closing: %v", + closeErr) + + default: log.Errorf("Error closing lnd connection: %v", closeErr) } }