Skip to content

ext_proc: deflake ObservabilityModeWithLogging - #48789

Merged
phlax merged 2 commits into
envoyproxy:mainfrom
derekargueta:dargueta-deflake-ext-proc-observability-logging
Nov 15, 2026
Merged

phlax merged 2 commits into
envoyproxy:mainfrom
derekargueta:dargueta-deflake-ext-proc-observability-logging

Conversation

@derekargueta

@derekargueta derekargueta commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

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_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

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]>
@repokitteh-read-only

Copy link
Copy Markdown

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!

🐱

Caused by: #48789 was opened by derekargueta.

see: more, trace.

@derekargueta
derekargueta marked this pull request as ready for review October 28, 2026 04:50
if (IsEnvoyGrpc()) {
test_server_->waitForCounter("cluster.ext_proc_server_0.upstream_rq_200", Ge(1));
}
handleUpstreamRequest();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Interesting, I thought for observability mode, the ext_proc server is not supposed to send back any response:

// 2. External processor should not send back processing response, as any responses will be ignored.
.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@RyanTheOptimist

Copy link
Copy Markdown
Contributor

/assign @yanjunxiang-google

…t-proc-observability-logging

Signed-off-by: Derek Argueta <[email protected]>
@derekargueta

Copy link
Copy Markdown
Member Author

/retest

@phlax

phlax commented Nov 15, 2026

Copy link
Copy Markdown
Member

Deflake numbers (envoy-ci-staging, --test_filter='*ObservabilityModeWithLogging/*'):

run result
forced repro: 1s sleep posted on the processor connection thread before startGrpcStream() 43760158807 /0 and /2 fail every run ("" vs "via_upstream"), /1 and /3 pass
forced repro + this PR 43760166709 400/400 pass
main @ da70d1a, asan, 1000 runs 43757085467 pass (doesn't reproduce naturally)
this PR, asan, 1000 runs 43758253285 pass

@phlax phlax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, thanks @derekargueta

@phlax
phlax merged commit 02153b3 into envoyproxy:main Nov 15, 2026
26 checks passed
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 15, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
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]>
phlax pushed a commit that referenced this pull request Nov 17, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 17, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 17, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 17, 2026
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]>
phlax pushed a commit that referenced this pull request Nov 17, 2026
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]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 18, 2026
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]>
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