-
Notifications
You must be signed in to change notification settings - Fork 112
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
Capture unexpected io.EOF errors as io.ErrUnexpectedEOF #533
Conversation
929c254
to
dc18bf1
Compare
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.
LGTM!
Do we have test cases today that cover other early-EOF scenarios? e.g. what about if we stop part-way through a frame?
@jchadwick-buf we do handle partial frames, this seems like an issue with request streams being able to close without a flag message but response streams should always have a final flagged end response. |
@jchadwick-buf not sure if we already have error testing around it but added two: partial message and partial frame. Fixed partial frame error message. |
67775d4
to
849635c
Compare
Is the error code the same for all three RPC protocols? I think we'll end up with |
For connect and gRPC-web on receiving end of stream payloads ensure no extra data is written by draining the reader and erroring on more data. Extension of https://github.com/bufbuild/connect-go/pull/533 Fixes https://github.com/bufbuild/connect-go/issues/427
Capture unexpected io.EOF errors as io.ErrUnexpectedEOF in client streams. Now raises an error when the stream doesn't end with an end response message. Fixes https://github.com/bufbuild/connect-go/issues/397
On Unmarshal we return
io.EOF
if there is no envelope header. TheerrSpecialEnvelope
wrapsio.EOF
and is used in client code to check for stream errors. To distinguish between them we can instead check onReceive
streams if the error is not a knownerrSpecialEnvelope
and return anio.ErrUnexpectedEOF
.Fixes https://github.com/bufbuild/connect-go/issues/397