Repository navigation
rpc: a method states its largest request with max_request_bytes, and Envoy refuses a larger one before the service reads it - #82
Merged
Conversation
…, and Envoy refuses a larger one before the service reads it (Part of #80) A method of an rpc entry can state the largest request message it takes, in bytes: `max_request_bytes` in a methods file, or the field of that name in the message of the option `rpc.proto` names. A whole number from 1 to 4294967290; a method that does not write it has no limit, and a file without the key renders as release 2.3.1 did. The Envoy output, for each method with a limit, writes five routes on the method's path before its own: - a GET is answered 405 with `allow: POST`, - a request of any other method whose path carries a query string is answered 400, because the Connect bridge builds a message from the query of a request that has no body and the filter counts no byte of it, - a request in which any value of grpc-encoding, content-encoding or connect-content-encoding is other than identity is answered 415, also when the header is written more than once (one regular expression per header, no inverted match), because the filter counts the bytes it receives and a compressed message is inflated only in the service. The method's own route turns on the buffer filter with the limit and the 5 bytes of the gRPC prefix, so a larger body is refused before the service reads any of it. The five refusal routes carry the method route's metadata and its question for the auth check, so a refused request takes a token from the rpc entry's rate limit and is asked about as the method's own call would be. A file is refused when a route written before the rpc entry takes the path of a method with a limit, because that limit would never apply, and when a method that takes a stream of requests sets the limit, because the filter holds a request until it ends. The nginx and HAProxy outputs refuse the key. docs/limits.md states what the limit holds and what it does not: a Connect unary call the bridge does not convert carries no prefix, so its body may be up to 5 bytes over the limit, and over HTTP/2 a body that arrives whole in one frame is not counted. The conformance battery checks each answer on Envoy 1.40.2 in a new scenario of 18 rows. The README and the docs name release 2.4.0.
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.
Closes #80
A method of an rpc entry can state the largest request message it takes:
max_request_bytesin a methods file, or the field of that name in the message of the optionrpc.protonames. A file without the key renders as release 2.3.1 did.413(a gRPC call:grpc-status2) before the service reads any of it.GETis answered405, a request of any other method whose path carries a query string400, and a request in which any value ofgrpc-encoding,content-encodingorconnect-content-encodingis other thanidentityis answered415, also when the header is written more than once.docs/limits.mdstates what the limit holds and what it does not (a body without a frame prefix may be up to 5 bytes over; over HTTP/2 a body that arrives whole in one frame is not counted).One independent review in two parts (the code and the tests; 185 request forms sent to a local Envoy), one round of corrections built tests first, and a second pass of the request forms at the corrected code with no important finding. The findings and what was changed for each are in the issue.
Run locally:
go test ./...at this tree with no failing package; and, one commit earlier, before three doc sentences changed and with the rendered output the same,scripts/validate-envoy.shon all 26 examples and the conformance battery'srequest-limit(18 rows) andfull(634 rows) scenarios on Envoy 1.40.2. The branch is squashed onto master with its tree unchanged.