From 0e72e09474d6f277fe497cded849ae1c609c27c6 Mon Sep 17 00:00:00 2001 From: Garrett Gutierrez Date: Fri, 21 Aug 2020 18:04:04 -0700 Subject: [PATCH] server: prevent hang in Go HTTP transport in some error cases (#3833) --- server.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server.go b/server.go index 85beec413974..ff71435fad72 100644 --- a/server.go +++ b/server.go @@ -1156,10 +1156,8 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } d, err := recvAndDecompress(&parser{r: stream}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp) if err != nil { - if st, ok := status.FromError(err); ok { - if e := t.WriteStatus(stream, st); e != nil { - channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status %v", e) - } + if e := t.WriteStatus(stream, status.Convert(err)); e != nil { + channelz.Warningf(logger, s.channelzID, "grpc: Server.processUnaryRPC failed to write status %v", e) } return err }