diff --git a/.changelog/11273.txt b/.changelog/11273.txt new file mode 100644 index 000000000..3bada6f66 --- /dev/null +++ b/.changelog/11273.txt @@ -0,0 +1,3 @@ +```release-note:bug +client: Removed spurious error log messages when tasks complete +``` diff --git a/drivers/shared/executor/client.go b/drivers/shared/executor/client.go index 1779d919a..44f459e91 100644 --- a/drivers/shared/executor/client.go +++ b/drivers/shared/executor/client.go @@ -16,6 +16,8 @@ import ( "github.com/hashicorp/nomad/helper/pluginutils/grpcutils" "github.com/hashicorp/nomad/plugins/drivers" dproto "github.com/hashicorp/nomad/plugins/drivers/proto" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) var _ Executor = (*grpcExecutorClient)(nil) @@ -132,12 +134,14 @@ func (c *grpcExecutorClient) handleStats(ctx context.Context, stream proto.Execu return } - if err != nil { - if err != io.EOF { - c.logger.Error("error receiving stream from Stats executor RPC, closing stream", "error", err) - } - - // End stream + if err == io.EOF || + status.Code(err) == codes.Unavailable || + status.Code(err) == codes.Canceled || + err == context.Canceled { + c.logger.Trace("executor Stats stream closed", "msg", err) + return + } else if err != nil { + c.logger.Warn("failed to receive Stats executor RPC stream, closing stream", "error", err) return }