Skip to content

test: deflake GrpcJsonTranscoderIntegrationTest multi-request cases - #49303

Merged
phlax merged 1 commit into
envoyproxy:mainfrom
derekargueta:dargueta-deflake-grpc-json-transcoder-server-streaming-get
Nov 16, 2026
Merged

phlax merged 1 commit into
envoyproxy:mainfrom
derekargueta:dargueta-deflake-grpc-json-transcoder-server-streaming-get

Conversation

@derekargueta

Copy link
Copy Markdown
Member

Commit Message: test: deflake GrpcJsonTranscoderIntegrationTest multi-request cases

testTranscoding() closes the fake upstream connection after each request and waits for the fake side to disconnect, but nothing waits for Envoy to process that close. Tests that call it more than once can have the next request handed to the dead pooled HTTP/2 connection, so the fake upstream never sees a new connection and waitForHttpConnection() times out. The helper now waits for cluster.cluster_0.upstream_cx_active to drop to 0 after the close.

Additional Description:
This hit ServerStreamingGet/IPv4, which sends three requests. It's the same failure as #44427 on DisableRequestValidation, which #44510 worked around by splitting that test into single-request tests. About 25 other tests in the file make several calls and pick this up too. The calls that pass expect_connection_to_upstream=false are local replies, so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test passes
  • same target with --test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*' --runs_per_test=50: 400/400 pass (macOS arm64, fastbuild)
    Docs Changes: N/A
    Release Notes: N/A
    Platform Specific Features: N/A

testTranscoding closes the fake upstream connection at the end of each call, but waitForDisconnect only sees the fake side's local close. Envoy's worker can still pick up the next request in the same test before it processes the remote close, assign it to the dead HTTP/2 connection, and the fake upstream never sees a new connection. Wait for cluster_0's upstream_cx_active gauge to reach zero after the close so every follow-up request gets a fresh upstream connection.

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: #49303 was opened by derekargueta.

see: more, trace.

@derekargueta
derekargueta marked this pull request as ready for review November 15, 2026 20:24
@phlax

phlax commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Deflake numbers (envoy-ci-staging, whole binary, so test ordering is as in CI):

config runs run result
main @ da70d1a default 300 43757032252 pass
main @ da70d1a tsan 100 43760174984 pass
main @ da70d1a asan 100 43760183283 pass
this PR default 300 43758227237 pass

So no repro in isolation, although this fails frequently in CI and has had several fix attempts that were never reproduced (see #44427/#44510).

I'm also not convinced by the mechanism. Each testTranscoding() call makes a new downstream connection, so before Envoy can route the next request the worker has to accept it and then read it, which takes at least two dispatcher iterations. The upstream FIN from the fake close is already readable by then and is handled in the first one, which removes the connection from the pool. Blocking the worker doesn't reverse that order, so I couldn't force the failure this way either.

Could you link the CI run where ServerStreamingGet/IPv4 failed? The test log there (Envoy's trace around the second request) should show whether the request really went out on the stale connection or whether something else happened, e.g. no upstream request at all. Before this lands we need a reproduction that fails without the change and passes with it.

(bot assisted)

fwiw ive tried several times to fix this - but never been able to repro so never landed anything

@derekargueta

Copy link
Copy Markdown
Member Author

Here's the run: https://github.com/envoyproxy/envoy/actions/runs/43680824372/job/132710880787. It's a release build so there's no trace, just the timeout at :78. I can't reproduce it and your ordering argument holds, so I'll close this.

@phlax

phlax commented Nov 16, 2026

Copy link
Copy Markdown
Member

Reopening: the diagnostics in #49317 caught the failure in CI (https://github.com/envoyproxy/envoy/actions/runs/43914182683/job/133463916675, ServerStreamingGet call 3). The client got a 503 "connection termination", with upstream_cx_total: 2, upstream_cx_destroy_remote_with_active_rq: 1 and upstream_rq_pending_failure_eject: 1.

The third request went out on the pooled connection the test had just closed, before Envoy had processed the close. No new connection was opened. That is what the upstream_cx_active == 0 wait here prevents.

(bot assisted)

@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 enabled auto-merge (squash) November 16, 2026 17:26
@phlax
phlax merged commit b794d7a into envoyproxy:main Nov 16, 2026
34 checks passed
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 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 b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 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 b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 pass (macOS arm64, fastbuild)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Backport note (release/v1.38): with this branch's `waitForGaugeEq()`, as it has
no `waitForGauge()` matcher overload (envoyproxy#44864).

(cherry picked from commit b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 pass (macOS arm64, fastbuild)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Backport note (release/v1.38): with this branch's `waitForGaugeEq()`, as it has
no `waitForGauge()` matcher overload (envoyproxy#44864).

(cherry picked from commit b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 pass (macOS arm64, fastbuild)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Backport note (release/v1.38): with this branch's `waitForGaugeEq()`, as it has
no `waitForGauge()` matcher overload (envoyproxy#44864).

(cherry picked from commit b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 pass (macOS arm64, fastbuild)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Backport note (release/v1.38): with this branch's `waitForGaugeEq()`, as it has
no `waitForGauge()` matcher overload (envoyproxy#44864).

(cherry picked from commit b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit that referenced this pull request Nov 17, 2026
…49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as #44427 on `DisableRequestValidation`, which #44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 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 b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 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 b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 pass (macOS arm64, fastbuild)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Backport note (release/v1.38): with this branch's `waitForGaugeEq()`, as it has
no `waitForGauge()` matcher overload (envoyproxy#44864).

(cherry picked from commit b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 pass (macOS arm64, fastbuild)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Backport note (release/v1.38): with this branch's `waitForGaugeEq()`, as it has
no `waitForGauge()` matcher overload (envoyproxy#44864).

(cherry picked from commit b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 pass (macOS arm64, fastbuild)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Backport note (release/v1.38): with this branch's `waitForGaugeEq()`, as it has
no `waitForGauge()` matcher overload (envoyproxy#44864).

(cherry picked from commit b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 pass (macOS arm64, fastbuild)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Backport note (release/v1.38): with this branch's `waitForGaugeEq()`, as it has
no `waitForGauge()` matcher overload (envoyproxy#44864).

(cherry picked from commit b794d7a)
Signed-off-by: Ryan Northey <[email protected]>
@derekargueta

Copy link
Copy Markdown
Member Author

Reopening: the diagnostics in #49317 caught the failure in CI (https://github.com/envoyproxy/envoy/actions/runs/43914182683/job/133463916675, ServerStreamingGet call 3). The client got a 503 "connection termination", with upstream_cx_total: 2, upstream_cx_destroy_remote_with_active_rq: 1 and upstream_rq_pending_failure_eject: 1.

The third request went out on the pooled connection the test had just closed, before Envoy had processed the close. No new connection was opened. That is what the upstream_cx_active == 0 wait here prevents.

(bot assisted)

nice sleuthing, thanks @phlax !

@derekargueta
derekargueta deleted the dargueta-deflake-grpc-json-transcoder-server-streaming-get branch November 17, 2026 22:27
phlax added a commit to phlax/envoy that referenced this pull request Nov 18, 2026
…nvoyproxy#49303)

`testTranscoding()` closes the fake upstream connection after each
request and waits for the fake side to disconnect, but nothing waits for
Envoy to process that close. Tests that call it more than once can have
the next request handed to the dead pooled HTTP/2 connection, so the
fake upstream never sees a new connection and `waitForHttpConnection()`
times out. The helper now waits for
`cluster.cluster_0.upstream_cx_active` to drop to 0 after the close.

Additional Description:
This hit `ServerStreamingGet/IPv4`, which sends three requests. It's the
same failure as envoyproxy#44427 on `DisableRequestValidation`, which envoyproxy#44510
worked around by splitting that test into single-request tests. About 25
other tests in the file make several calls and pick this up too. The
calls that pass `expect_connection_to_upstream=false` are local replies,
so the wait returns immediately for them.

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/grpc_json_transcoder:grpc_json_transcoder_integration_test`
passes
- same target with
`--test_filter='IpVersions/GrpcJsonTranscoderIntegrationTest.ServerStreaming*'
--runs_per_test=50`: 400/400 pass (macOS arm64, fastbuild)
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Derek Argueta <[email protected]>
Backport note (release/v1.38): with this branch's `waitForGaugeEq()`, as it has
no `waitForGauge()` matcher overload (envoyproxy#44864).

(cherry picked from commit b794d7a)
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.

2 participants