envoy icon indicating copy to clipboard operation
envoy copied to clipboard

buffer_filter: allow to set the maximum size Without buffering data immediately

Open spacewander opened this issue 1 year ago • 3 comments

Commit Message: buffer_filter: allow to set the maximum size Without buffering data immediately Additional Description: Risk Level: Low, doesn't change the default behavior Testing: Unit & Integration Docs Changes: Release Notes: Platform Specific Features: [Optional Runtime guard:] Fixes #32205 [Optional Fixes commit #PR or SHA] [Optional Deprecated:] [Optional API Considerations:]

spacewander avatar Feb 26 '24 04:02 spacewander

As a reminder, PRs marked as draft will not be automatically assigned reviewers, or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

:cat:

Caused by: https://github.com/envoyproxy/envoy/pull/32571 was opened by spacewander.

see: more, trace.

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/). envoyproxy/api-shepherds assignee is @abeyad CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

:cat:

Caused by: https://github.com/envoyproxy/envoy/pull/32571 was opened by spacewander.

see: more, trace.

I am blocked by how to run the corresponding test. In the integration test, I used a Lua filter to simulate a filter that buffers the request. However, I get the error C++ exception with the description "Unable to parse JSON as proto (INVALID_ARGUMENT: could not find @type 'type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua'): ....

I have checked that the type of Lua filter is correct. I don't know why this type is not found.

Can anyone help me, please? Thanks!

spacewander avatar Feb 26 '24 06:02 spacewander

@abeyad Thanks for your suggestion! Updated.

spacewander avatar Feb 28 '24 02:02 spacewander

/wait ci

abeyad avatar Mar 04 '24 15:03 abeyad

I am blocked by how to run the corresponding test. In the integration test, I used a Lua filter to simulate a filter that buffers the request. However, I get the error C++ exception with the description "Unable to parse JSON as proto (INVALID_ARGUMENT: could not find @type 'type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua'): ....

I have checked that the type of Lua filter is correct. I don't know why this type is not found.

Can anyone help me, please? Thanks!

@abeyad I have an issue with writing a test to simulate the case that a subsequence filter does the buffering. Would you help me please?

spacewander avatar Mar 05 '24 03:03 spacewander

I am blocked by how to run the corresponding test. In the integration test, I used a Lua filter to simulate a filter that buffers the request. However, I get the error C++ exception with the description "Unable to parse JSON as proto (INVALID_ARGUMENT: could not find @type 'type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua'): .... I have checked that the type of Lua filter is correct. I don't know why this type is not found. Can anyone help me, please? Thanks!

@abeyad I have an issue with writing a test to simulate the case that a subsequence filter does the buffering. Would you help me please?

This is probably because the filter isn't linked. Will it be possible to use one of the integration tests filters instead? This will reduce coupling with other filters. Note that adding the filter to the build target (in the BUILD file) is also needed.

adisuissa avatar Mar 05 '24 04:03 adisuissa

@adisuissa Thanks for your suggestion! I will update the test soon.

spacewander avatar Mar 05 '24 07:03 spacewander

sorry, is the goal of this PR simply to have a way of calling setDecoderBufferLimit on the filter manager? I don't think it makes sense to add config to the buffer filter for this. Is there a reason you can't use the existing flow control knobs? https://www.envoyproxy.io/docs/envoy/latest/faq/configuration/flow_control /wait

There is a user case that people may want to increase the limit for a separate route. For example, a route that is covered by a WAF rule (which needs the whole request body) may need to increase its limit so no 413 response is triggered unexpectedly. As discussed in https://github.com/envoyproxy/envoy/issues/32205, there is no solution to cover this user case. Using the buffer filter is OK, but it will buffer the whole request unconditionally.

We can also add this feature to a new HTTP filter. One thing I am concerned about is whether adding a new filter for this purpose is overkill. But it is up to you to make the decision.

spacewander avatar Mar 06 '24 02:03 spacewander

We already have envoy per-route config https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route.proto I think changing buffer limits makes more sense there than in a filter many may not use.

alyssawilk avatar Mar 06 '24 16:03 alyssawilk

We already have envoy per-route config https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route.proto I think changing buffer limits makes more sense there than in a filter many may not use.

Do you mean adding a max_request_bytes field to RouteConfiguration message?

spacewander avatar Mar 07 '24 01:03 spacewander

something like that yes. cc @envoyproxy/api-shepherds

alyssawilk avatar Mar 07 '24 14:03 alyssawilk

Will submit a new one with the new method.

spacewander avatar Mar 12 '24 09:03 spacewander