-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't fatal on encoding errors #1025
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a test.
@@ -261,28 +261,27 @@ func encode(c Codec, msg interface{}, cp Compressor, cbuf *bytes.Buffer, outPayl | |||
var ( | |||
b []byte | |||
length uint | |||
err error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the changes in this file are unnecessary (and the new code is worse, since it increases the scope of err
needlessly).
// the optimal option. | ||
grpclog.Fatalf("grpc: Server failed to encode response %v", err) | ||
err = fmt.Errorf("grpc: Server failed to encode response %v", err) | ||
grpclog.Println(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this just return the error directly instead of also logging it?
b46ee02
to
3a8c6ec
Compare
// faulty stream locally and remotely (Other streams can keep going). Find | ||
// the optimal option. | ||
grpclog.Fatalf("grpc: Server failed to encode response %v", err) | ||
err = fmt.Errorf("grpc: Server failed to encode response %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encode() should return a status error instead, and then we can just return it.
Replaced by #1251 |
fixes #532
cc @songshine @ashishgandhi