Block sending of oversize messages#127
Closed
acclassic wants to merge 1 commit intocontainerd:mainfrom
Closed
Conversation
kzys
reviewed
Jan 26, 2023
Member
|
Regarding RESOURCE_EXHAUSTED, https://github.com/grpc/grpc-go/blob/87eb5b7502493f758e76c4d09430c0049a81a557/codes/codes.go#L92-L98
Seems gRPC is doing the same. |
Member
|
Would it replace #119? |
When trying to send a message that is bigger than the max message length the send function will return an GRPC error 8 (RESOURCE_EXHAUSTED). It will also close the connection so that the read function discards the unused message. Signed-off-by: Alessio Cantillo <cantillo.trd@gmail.com>
8a595b2 to
6fd1b7a
Compare
Contributor
Author
dmcgowan
reviewed
Feb 29, 2024
|
|
||
| if status.Code() != codes.ResourceExhausted { | ||
| t.Fatalf("expected grpc status code: %v != %v", status.Code(), codes.ResourceExhausted) | ||
| if err != nil { |
Member
There was a problem hiding this comment.
This test shouldn't branch, if an error is expected this should assert the error is not nil.
Member
|
@acclassic are you still working on this? Are you able to address the review comments? |
Member
|
Closing, PR #171 merged with implementation for sender-side reject. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While looking to solve the containerd bug #6248 (containerd/containerd#6248 (comment)) I saw that it was already solved but the message would only be checked for the length after sending. Like @dmcgowan noted the message should not even be sent because it will be discarded anyway. I changed the code so that the send function will check for the size and not send the message in case the length is longer than the max message length. I opted for an GRPC error code 8 (RESOURCE_EXHAUSTED) over error code 3 (INVALID_ARGUMENT) because it describes the error better.
I hope that this is what we were looking for and I'm open to any input.