Merge pull request #35499 from cpuguy83/erroneous_errors

Cancelation errors should not be logged
This commit is contained in:
Sebastiaan van Stijn 2017-11-15 11:34:28 +01:00 committed by GitHub
commit 7c16e4d417
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -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 {

View file

@ -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
}