From b86746d60d4c43dcadd3b95fc4b2da7c03323d84 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Tue, 14 Nov 2017 17:00:47 -0500 Subject: [PATCH] Cancelation errors should not be logged Signed-off-by: Brian Goff --- daemon/cluster/noderunner.go | 7 ++++++- libcontainerd/client_daemon.go | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/daemon/cluster/noderunner.go b/daemon/cluster/noderunner.go index aa12737cdd..6aae6c3271 100644 --- a/daemon/cluster/noderunner.go +++ b/daemon/cluster/noderunner.go @@ -17,6 +17,8 @@ import ( "github.com/sirupsen/logrus" "golang.org/x/net/context" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) // nodeRunner implements a manager for continuously running swarmkit node, restarting them with backoff delays if needed. @@ -217,7 +219,10 @@ func (n *nodeRunner) watchClusterEvents(ctx context.Context, conn *grpc.ClientCo msg, err := watch.Recv() if err != nil { // store watch is broken - logrus.WithError(err).Error("failed to receive changes from store watch API") + errStatus, ok := status.FromError(err) + if !ok || errStatus.Code() != codes.Canceled { + logrus.WithError(err).Error("failed to receive changes from store watch API") + } return } select { diff --git a/libcontainerd/client_daemon.go b/libcontainerd/client_daemon.go index 24c0c80197..f1b5f011f8 100644 --- a/libcontainerd/client_daemon.go +++ b/libcontainerd/client_daemon.go @@ -17,6 +17,8 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/containerd/containerd" eventsapi "github.com/containerd/containerd/api/services/events/v1" @@ -687,7 +689,10 @@ func (c *client) processEventStream(ctx context.Context) { for { ev, err = eventStream.Recv() if err != nil { - c.logger.WithError(err).Error("failed to get event") + errStatus, ok := status.FromError(err) + if !ok || errStatus.Code() != codes.Canceled { + c.logger.WithError(err).Error("failed to get event") + } return }