Skip to content
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

wasm: Force stop iteration after local response is sent #13930

Merged
merged 7 commits into from
Nov 11, 2020

Conversation

mathetake
Copy link
Member

@mathetake mathetake commented Nov 7, 2020

Signed-off-by: mathetake <takeshi@tetrate.io>
@repokitteh-read-only
Copy link

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).

🐱

Caused by: #13930 was opened by mathetake.

see: more, trace.

@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Nov 7, 2020
PiotrSikora
PiotrSikora previously approved these changes Nov 9, 2020
Copy link
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

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

LGTM once the repository updated to point to the merged commit.

Signed-off-by: mathetake <takeshi@tetrate.io>
@mathetake mathetake changed the title wasm: stop iteration when local reply sent wasm: Force stop iteration after local response is sent Nov 9, 2020
Copy link
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

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

Something is broken.

/wait

Signed-off-by: mathetake <takeshi@tetrate.io>
Signed-off-by: mathetake <takeshi@tetrate.io>
Signed-off-by: mathetake <takeshi@tetrate.io>
Signed-off-by: mathetake <takeshi@tetrate.io>
PiotrSikora
PiotrSikora previously approved these changes Nov 10, 2020
Signed-off-by: mathetake <takeshi@tetrate.io>
@@ -1436,7 +1436,8 @@ TEST_P(WasmHttpFilterTest, RootId2) {
setupFilter("context2");
EXPECT_CALL(filter(), log_(spdlog::level::debug, Eq(absl::string_view("onRequestHeaders2 2"))));
Http::TestRequestHeaderMapImpl request_headers;
EXPECT_EQ(Http::FilterHeadersStatus::Continue, filter().decodeHeaders(request_headers, true));
EXPECT_EQ(Http::FilterHeadersStatus::StopAllIterationAndWatermark,
filter().decodeHeaders(request_headers, true));
Copy link
Contributor

@antoniovicente antoniovicente Nov 10, 2020

Choose a reason for hiding this comment

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

Given that the filter code is in a different repo, does it make sense to have assertions like this one about the return values of decodeHeaders in the main repo? It doesn't seem right to me. This PR can go in anyway, but we should rethink how this works going forward.

Copy link
Contributor

Choose a reason for hiding this comment

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

The test filter is in this repo, this is the test case for which the behavior changed:

FilterHeadersStatus Context2::onRequestHeaders(uint32_t, bool) {
logDebug(std::string("onRequestHeaders2 ") + std::to_string(id()));
CHECK_RESULT(sendLocalResponse(200, "ok", "body", {{"foo", "bar"}}));
return FilterHeadersStatus::Continue;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

So the coding error was in a wasm filter implementation, not in the wasm framework itself?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this protects against coding errors in user-supplied Wasm filters (i.e. FilterHeadersStatus::Continue returned after sendLocalResponse() above).

@lizan lizan merged commit d525ae7 into envoyproxy:master Nov 11, 2020
@mathetake mathetake deleted the wasm-local-reply-stop branch November 11, 2020 07:34
PiotrSikora pushed a commit to PiotrSikora/envoy that referenced this pull request Nov 19, 2020
istio-testing pushed a commit to istio/envoy that referenced this pull request Nov 20, 2020
* build: update rules_rust to allow Rustc in RBE (envoyproxy#13595)

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* fix macos v8 build (envoyproxy#13572)

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

* wasm: update proxy-wasm-cpp-host (envoyproxy#13606)

The PR updates proxy-wasm-cpp-host dependency for enhancing the capability and fixing a bug in WASM extensions.

The change consists of three PRs in proxy-wasm-cpp-host:

1. proxy-wasm/proxy-wasm-cpp-host#68 @PiotrSikora
2. proxy-wasm/proxy-wasm-cpp-host#65 @mathetake (me)
3. proxy-wasm/proxy-wasm-cpp-host#64 @mathetake (me)

The code change can be found at proxy-wasm/proxy-wasm-cpp-host@49ed20e...c5658d3 .

1 & 2 enhance WASM capability, and 3 fixes a bug in situations where users share vm_id for multiple filters. For details, please take a look at these original PRs.

Signed-off-by: mathetake <takeshi@tetrate.io>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* wasm: re-enable tests with precompiled modules. (envoyproxy#13583)

Fixes envoyproxy#12335.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* wasm: flip the meaning of the "repository" in envoy_wasm_cc_binary(). (envoyproxy#13621)

Change the meaning of the "repository" parameter to refer to an external
Bazel repository, instead of using "@envoy" in targets that are included
in the Envoy repository.

This aligns with other envoy_* rules.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* build: support ppc64le with wasm (envoyproxy#13657)

The build has only been tested with gn git sha 5da62d5 as
recommended by ppc64 maintainers of the v8 runtime.

Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>

* wasm: remove no longer needed Emscripten metadata. (envoyproxy#13667)

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* fix wasm compilation (envoyproxy#13765)

Signed-off-by: Asra Ali <asraa@google.com>

* wasm: strip only Custom Sections with precompiled Wasm modules. (envoyproxy#13775)

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* build: don't build shared libraries for zlib and zlib-ng. (envoyproxy#13652)

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* wasm: update V8 to v8.7.220.10. (envoyproxy#13568)

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* build: exclude wee8/out from inputs (envoyproxy#13866)

If you build without sandboxing for performance, the output files from
this custom build genrule contained timestamps which caused it to
rebuild every single build.

Signed-off-by: Keith Smiley <keithbsmiley@gmail.com>

* tls: fix detection of the upstream connection close event. (envoyproxy#13858)

Fixes envoyproxy#13856.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* wasm: Force stop iteration after local response is sent (envoyproxy#13930)

Resolves envoyproxy#13857

ref:
-proxy-wasm/proxy-wasm-rust-sdk#44
-proxy-wasm/proxy-wasm-cpp-host#88
-proxy-wasm/proxy-wasm-cpp-host#93

Signed-off-by: mathetake <takeshi@tetrate.io>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* wasm: fix order of callbacks for paused requests. (envoyproxy#13840)

Fixes proxy-wasm/proxy-wasm-rust-sdk#43.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* wasm: fix network leak (envoyproxy#13836)

Signed-off-by: Kuat Yessenov <kuat@google.com>

Co-authored-by: Lizan Zhou <lizan@tetrate.io>
Co-authored-by: Rama Chavali <rama.rao@salesforce.com>
Co-authored-by: Takeshi Yoneda <yoneda.takeshi.md@alumni.tsukuba.ac.jp>
Co-authored-by: cmluciano <cmluciano@us.ibm.com>
Co-authored-by: asraa <asraa@google.com>
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
Co-authored-by: Takeshi Yoneda <takeshi@tetrate.io>
Co-authored-by: Kuat <kyessenov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deps Approval required for changes to Envoy's external dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash using wasm-filter
4 participants