Reopening: Server shouldn't Fatalf in case it fails to encode. (#1276)

* Server shouldn't Fatalf in case it fails to encode.
This commit is contained in:
MakMukhi
2017-06-02 12:32:37 -07:00
committed by GitHub
parent a8cd0c13a4
commit 6fecf2831a
5 changed files with 49 additions and 13 deletions

View File

@ -664,14 +664,8 @@ func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Str
}
p, err := encode(s.opts.codec, msg, cp, cbuf, outPayload)
if err != nil {
// This typically indicates a fatal issue (e.g., memory
// corruption or hardware faults) the application program
// cannot handle.
//
// TODO(zhaoq): There exist other options also such as only closing the
// faulty stream locally and remotely (Other streams can keep going). Find
// the optimal option.
grpclog.Fatalf("grpc: Server failed to encode response %v", err)
grpclog.Println("grpc: server failed to encode response: ", err)
return err
}
if len(p) > s.opts.maxSendMessageSize {
return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(p), s.opts.maxSendMessageSize)