Skip to content

Commit

Permalink
Reduce log spam in transport service
Browse files Browse the repository at this point in the history
The grpc status conversion handled by trace does not map a canceled
status to context.Canceled which leads to additional log spam that
confuses users.
  • Loading branch information
rosstimothy authored and github-actions committed Jul 26, 2024
1 parent 0bb651b commit 7b7fe8a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/srv/transport/transportv1/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import (
"github.com/gravitational/trace"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh/agent"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"

transportv1pb "github.com/gravitational/teleport/api/gen/proto/go/teleport/transport/v1"
streamutils "github.com/gravitational/teleport/api/utils/grpc/stream"
Expand Down Expand Up @@ -239,7 +241,7 @@ func (s *Service) ProxySSH(stream transportv1pb.TransportService_ProxySSHServer)
for {
req, err := stream.Recv()
if err != nil {
if !utils.IsOKNetworkError(err) && !errors.Is(err, context.Canceled) {
if !utils.IsOKNetworkError(err) && !errors.Is(err, context.Canceled) && status.Code(err) != codes.Canceled {
s.cfg.Logger.Errorf("ssh stream terminated unexpectedly: %v", err)
}

Expand Down

0 comments on commit 7b7fe8a

Please sign in to comment.