Skip to content

filter: Add CacheFilter: a pluggable HTTP caching filter#10019

Merged
mattklein123 merged 19 commits intoenvoyproxy:masterfrom
toddmgreer:CacheFilter2
Feb 21, 2020
Merged

filter: Add CacheFilter: a pluggable HTTP caching filter#10019
mattklein123 merged 19 commits intoenvoyproxy:masterfrom
toddmgreer:CacheFilter2

Conversation

@toddmgreer
Copy link
Contributor

Description: Add CacheFilter: a pluggable HTTP caching filter. Split from #7198.
Risk Level: Low: nobody uses this new filter
Testing: Unit tests. Integration tests to follow in next PR.
Docs Changes: none
Release Notes: Do we add release notes for WIP filters?
#868

… interface.

Signed-off-by: Todd Greer <tgreer@google.com>
@toddmgreer toddmgreer requested a review from jmarantz as a code owner February 12, 2020 08:38
@mattklein123 mattklein123 self-assigned this Feb 12, 2020
@yanavlasov yanavlasov self-assigned this Feb 12, 2020
@toddmgreer
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

🤷‍♀️ nothing to rebuild.

🐱

Caused by: a #10019 (comment) was created by @toddmgreer.

see: more, trace.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff. Flushing some high level comments that we should resolve first. Thank you!

/wait

Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
@toddmgreer
Copy link
Contributor Author

@mattklein123 We're almost through the code in #7198. After this PR, I have two more small ones prepped and ready to go: one for CacheFilterFactory (+ unit tests) and one for CacheIntegrationTest. I should be able to open each PR as soon as the prior one is merged.

Will you be able to continue reviewing into next week? I'm hoping to get this series fully merged as early next week as possible.

Thank you for all the reviews!

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One high level question and needs a master merge and then I will take another pass. Thank you!

/wait

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff. A few more high level questions. Thank you!

/wait

Signed-off-by: Todd Greer <tgreer@google.com>
…all to OnBodyAsync.

Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
…do and

don't respond immediately to getHeaders.

Signed-off-by: Todd Greer <tgreer@google.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM other than the stop iteration issue I highlighted. I would recommend adding an integration test that will help us test various real-world permutations. I don't think it will be that much work. Thank you! Very cool stuff and excited to see this land so we can iterate on it.

/wait

…mment.

Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
@toddmgreer
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: coverage (failed build)

🐱

Caused by: a #10019 (comment) was created by @toddmgreer.

see: more, trace.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a test request. Also please merge master to fix the coverage test flake. Thank you!

/wait


// Send first request, and get response from upstream.
{
IntegrationStreamDecoderPtr request = codec_client_->makeHeaderOnlyRequest(request_headers);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some integration tests with body, trailers, etc.? This would have caught the stop iteration issue I found.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed CacheFilter to refuse to cache requests with bodies and/or trailers, because caching GET requests with bodies would turn an ordinary request smuggling vector into cache poisoning, and because GET/HEAD requests with bodies have no meaning. If it turns out to be needed, we may want to add a config knob to allow caching them.

Added unit and integration tests for them.

…est smuggling, and the spec doesn't define any meaning for GET/HEAD requests with bodies.

Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, nice work. Let's ship and iterate!

@mattklein123 mattklein123 merged commit f6b00e9 into envoyproxy:master Feb 21, 2020
@toddmgreer
Copy link
Contributor Author

Woohoo! Thank you for all of your reviews!

@SaveTheRbtz
Copy link
Contributor

JFYI: @toddmgreer I saw some flakiness on cache_filter_integration_test:

$ bazel test --runs_per_test 1000 //test/extensions/filters/http/cache:cache_filter_integration_test
...
[ RUN      ] Protocols/CacheIntegrationTest.GetRequestWithBodyAndTrailers/IPv6_HttpDownstream_HttpUpstream
[2020-02-29 23:18:30.012][21766583][critical][backtrace] [bazel-out/darwin-fastbuild/bin/source/server/_virtual_includes/backtrace_lib/server/backtrace.h:83] Caught Segmentation fault: 11, suspect faulting address 0x0
[2020-02-29 23:18:30.012][21766583][critical][backtrace] [bazel-out/darwin-fastbuild/bin/source/server/_virtual_includes/backtrace_lib/server/backtrace.h:70] Backtrace (use tools/stack_decode.py to get line numbers):
[2020-02-29 23:18:30.012][21766583][critical][backtrace] [bazel-out/darwin-fastbuild/bin/source/server/_virtual_includes/backtrace_lib/server/backtrace.h:71] Envoy version: 0/1.14.0-dev/redacted/DEBUG/BoringSSL

(sadly it doesn't print traceback on macos (even with -fno-omit-frame-pointer))

@toddmgreer
Copy link
Contributor Author

@SaveTheRbtz I'm not getting any failures testing on my Linux workstation, either at 1k runs_per_test, or at 10k. I'd like to figure this out, but I need more to go on, such as a stack trace. Also, what revision were you at? If you can the crash to tell you a bit more, please file an issue.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants