Skip to content

Commit

Permalink
server: prevent hang in Go HTTP transport in some error cases (#3833)
Browse files Browse the repository at this point in the history
  • Loading branch information
GarrettGutierrez1 committed Aug 22, 2020
1 parent b9bc8e7 commit 0e72e09
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions server.go
Expand Up @@ -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
}
Expand Down

0 comments on commit 0e72e09

Please sign in to comment.