Repository navigation
Conversation
In observability mode the main request does not wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer at once, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as "" rather than "via_upstream" (logging_test_filter.cc:47). Wait for cluster.ext_proc_server_0.upstream_rq_200 before answering the main request. The router charges it in the same callback that sets "via_upstream". This is the same race envoyproxy#47390 fixed for the CloseStream variant. Signed-off-by: Derek Argueta <[email protected]>
| if (IsEnvoyGrpc()) { | ||
| test_server_->waitForCounter("cluster.ext_proc_server_0.upstream_rq_200", Ge(1)); | ||
| } | ||
| handleUpstreamRequest(); |
There was a problem hiding this comment.
handleUpstreamRequest() already has the fake_upstream[0]_->waitForHttpConnection() logic.
The flakiness of the logging_test_filter and "via_upstream" is wellknown. However, it's not clear to me why this change fixes that issue.
There was a problem hiding this comment.
Right, but that waitForHttpConnection() waits on the main upstream (fake_upstreams_[0]). In observability mode Envoy connects there as soon as it sends the request headers, so the wait tells us nothing about the ext_proc side stream.
The race is with the side stream. startGrpcStream() in processRequestHeadersMessage() only queues the response headers on the fake ext_proc connection's thread. handleUpstreamRequest() then answers the main request on a different socket. If Envoy finishes the main response first, logStreamInfoBase() copies the side stream's response code details before its router has set via_upstream (ext_proc.cc:1525). The filter then reads "" at logging_test_filter.cc:47.
The router charges upstream_rq_200 on ext_proc_server_0 in the same callback that sets via_upstream. Waiting for that counter before handleUpstreamRequest() makes Envoy finish the side stream's headers before the main response. It's the same race #47390 fixed for CloseStream. With a 1s sleep before startGrpcStream(), /0 and /2 failed 6/6 without this change and passed with it.
There was a problem hiding this comment.
Interesting, I thought for observability mode, the ext_proc server is not supposed to send back any response:
.However, looking into these observability integration test, they are sending header responses somehow. Should we remove processRequestHeadersMessage(*grpc_upstreams_[0], true, std::nullopt); here?
Adding @tyxia
There was a problem hiding this comment.
If we drop that call the test fails every time, because it's also what calls startGrpcStream(). via_upstream only gets set once Envoy sees those gRPC response headers, so without them it's always empty. I read the proto as saying the server shouldn't send ProcessingResponse messages, and Envoy ignores them in this mode anyway. I could pass a callback that returns false so we send the headers and skip the message, if that seems cleaner? We'd still need the counter wait though, since the race is on the headers.
|
/assign @yanjunxiang-google |
…t-proc-observability-logging Signed-off-by: Derek Argueta <[email protected]>
|
/retest |
|
Deflake numbers (envoy-ci-staging,
|
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race #47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft #47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race #47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft #47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as `""` instead of `"via_upstream"` (`logging_test_filter.cc:47`). This waits for `cluster.ext_proc_server_0.upstream_rq_200` before answering the main request, since the router charges it in the same callback that sets `via_upstream`. It's the same race envoyproxy#47390 fixed for the `CloseStream` variant. Additional Description: Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params `/0` and `/2`. Draft envoyproxy#47626 waits on the same counter, but after `handleUpstreamRequest()`, which is too late to order the two, and with the removed `waitForCounterGe`. To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before `startGrpcStream()`. Without the fix, `/0` and `/2` failed on every run with the CI message, and `/1` and `/3` passed. With the fix and the sleep, every run passed. AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening. Risk Level: Low (test only) Testing: - forced-ordering repro above: 6/6 failures before, 0 after - `bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20`: 80/80 pass (macOS arm64, fastbuild) Docs Changes: N/A Release Notes: N/A Platform Specific Features: N/A Signed-off-by: Derek Argueta <[email protected]> (cherry picked from commit 02153b3) Signed-off-by: Ryan Northey <[email protected]>
Commit Message: ext_proc: deflake ObservabilityModeWithLogging
In observability mode the main request doesn't wait for the ext_proc side stream. The test has the fake ext_proc server send its response headers and then has the main upstream answer straight away, from a different thread on a different socket, so Envoy can finish the main response first. The logging test filter then reads the side stream's response code details as
""instead of"via_upstream"(logging_test_filter.cc:47).This waits for
cluster.ext_proc_server_0.upstream_rq_200before answering the main request, since the router charges it in the same callback that setsvia_upstream. It's the same race #47390 fixed for theCloseStreamvariant.Additional Description:
Over the last 30 days of Envoy/Checks this failed on 9 changes (3 main postsubmit, 4 release/v1.39 postsubmit, 2 unrelated PRs) on OpenSSL, Coverage, asan and Compile time options, always on the Envoy gRPC params
/0and/2. Draft #47626 waits on the same counter, but afterhandleUpstreamRequest(), which is too late to order the two, and with the removedwaitForCounterGe.To force the ordering locally, I posted a 1s sleep onto the fake ext_proc connection's thread just before
startGrpcStream(). Without the fix,/0and/2failed on every run with the CI message, and/1and/3passed. With the fix and the sleep, every run passed.AI Disclosure: code change created with AI assistance, fully reviewed by me prior to opening.
Risk Level: Low (test only)
Testing:
bazel test //test/extensions/filters/http/ext_proc:ext_proc_observability_integration_test --test_filter='*ObservabilityModeWithLogging/*' --runs_per_test=20: 80/80 pass (macOS arm64, fastbuild)Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A