-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Allow deframer errors to close stream with a status code #11073
Conversation
|
Tests & linters finally seem like they're passing. @ejona86 can you recommend someone who could review this PR and help audit for other parts of the Netty implementation that need to be adjusted? |
38db01a
to
93018a8
Compare
I missed the bit in CONTRIBUTING.md about maintaining a clean commit history. Tidied this up. This change did not affect any existing tests. I added a new test specifically for this behavior, but it's fairly low-level. I tested manually this end-to-end by sending an oversized request and validating that I now get a |
a7af803
to
6d0ec99
Compare
I think that |
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 looks good, with one null check needed
Yeah, don't worry about it. |
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.
Thank you!
Easy build failure:
|
Someday I'll push a commit that doesn't have a formatting error, but apparently not today :) |
I'm used to squash-merging. Anything I need to do on my end to get this PR merged? |
We would squash when we merge. But you can squash yourself if you want more control of the commit message. (And this is a fine time to squash, as it won't make the review harder.) Looks like the commit message on your first commit is still accurate. I would probably end up prefixing the git commit title with "netty: " and append |
61130d6
to
0b31bda
Compare
Today, deframer errors cancel the stream without communicating a status code to the peer. This change causes deframer errors to trigger a best-effort attempt to send trailers with a status code so that the peer understands why the stream is being closed. Fixes grpc#3996
0b31bda
to
fc49d80
Compare
Squashed everything down and made the formatting suggestions 👍 |
Relevant to #3996
Today, if the deframer encounters an error it will trigger a stream reset. This does not provide the peer with much information about why the stream was reset. In particular, if a client sends an oversized message, the server will
reject the request, but the client will see that as a
CANCELLED
status code rather than aRESOURCE_EXHAUSTED
.grpc-go servers do provide this information to clients, and I think that's helpful.
This PR is an attempt to provide best-effort status codes to peers on deframer errors. @ejona86 explained (here) that it will not always be possible for the stream to gracefully close with properly encoded trailers. In these cases the peer will see garbled data. But in some circumstances — including the very prevalent case of a unary request payload that is too large — the status will be well-formed and useful.