Skip to content

test: dump diagnostics when transcoder integration test misses upstream connection - #49317

Closed
phlax wants to merge 2 commits into
envoyproxy:mainfrom
phlax:gjt-flake-diagnostics
Closed

phlax wants to merge 2 commits into
envoyproxy:mainfrom
phlax:gjt-flake-diagnostics

Conversation

@phlax

@phlax phlax commented Nov 16, 2026

Copy link
Copy Markdown
Member

Commit Message: test: dump diagnostics when transcoder integration test misses upstream connection
Additional Description:
GrpcJsonTranscoderIntegrationTest occasionally times out in waitForHttpConnection() at testTranscoding() in CI, under both tsan and release builds, and it has never been reproduced. Recent examples: ServerStreamingGet/IPv4 (release, job), QueryParams/IPv6 and RejectUnknownQueryParam/IPv4 (tsan).

In each case the full timeout ran out without Envoy opening an upstream connection, and nothing arrived late, so this is not a slow-CI flake. Attempts to reproduce it on RBE all passed:

  • targeted cases, release, 200×200 repeats: 43832097867
  • whole binary, release, 300×40 repeats: 43833246451
  • targeted cases pinned to one CPU with 3 busy-loop hogs, 200×50: 43833681749
  • targeted cases, tsan, 100×50: 43832103421

CI logs have no trace, so the mechanism can't be identified from them. On this failure the test now records the downstream response and the non-zero cluster_0/http stats. That separates three cases: a request sent on a stale pooled connection (as #49303 proposed), an upstream connect failure, and a request that never left Envoy.

Risk Level: Low (test only)
Testing: CI
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

…am connection

GrpcJsonTranscoderIntegrationTest occasionally times out in
waitForHttpConnection() in CI (tsan and release) and has never been
reproduced on RBE, including CPU-starved and whole-binary repeat runs.
Record the downstream response and the non-zero cluster/http stats when
this happens so the next CI failure shows whether the request was
answered locally, sent on a stale pooled connection, or never left Envoy.

Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax requested a review from nezdolik as a code owner November 16, 2026 10:12
@phlax

phlax commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

@derekargueta, following up on #49303. Your failing run turned out to be call 3 of ServerStreamingGet; I symbolized the CI binary from EngFlow CAS to find that. So there was a pooled connection from call 2, and the stale-connection theory is still possible. However, none of the RBE runs above reproduced it, not even with forced CPU starvation, so we have no proof either way.

Instead of guessing, this PR makes the next CI failure diagnose itself:

  • 503 with upstream_cx_destroy_remote / upstream_rq_pending_failure_eject set: the request went out on a stale connection. Your fix from test: deflake GrpcJsonTranscoderIntegrationTest multi-request cases #49303 is then the right one, and we can reopen it.
  • upstream_cx_connect_fail / connect timeout: the problem is on the fake upstream accept side.
  • No response and upstream_rq_total not incremented: the request is stuck in Envoy.

If you see it fail again before we do, the dump will be in the test log.

(bot assisted)

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues are recorded for the integration-test diagnostics change.

No open issues 🎉

What changed in this PR

Adds failure diagnostics to Envoy’s gRPC JSON transcoder integration tests to help investigate intermittent missing upstream connections without changing production behavior.

Changes:

  • Records the downstream response status and body, reset reason, or absence of a completed response.
  • Dumps non-zero cluster_0 and HTTP counters, plus cluster_0 gauges.
  • Runs diagnostics when the upstream connection wait fails, preserving the existing assertion.
File Description
test/​extensions/​filters/​http/​grpc_json_transcoder/​grpc_json_transcoder_integration_test.cc Adds and invokes diagnostics for upstream connection wait failures.

Review effort: Balanced

Comment on lines +106 to +111
testing::AssertionResult connected =
fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_);
if (!connected) {
dumpMissingUpstreamConnection(*response);
}
ASSERT_TRUE(connected);

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.

I think rather than dumpMissingUpstreamConnection doing ADD_FAILURE() at the end and then this weirdness, you could just do...

Suggested change
testing::AssertionResult connected =
fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_);
if (!connected) {
dumpMissingUpstreamConnection(*response);
}
ASSERT_TRUE(connected);
ASSERT_TRUE(
fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)) << dumpMissingUpstreamConnection(*response);

here, and have dumpMissingUpstreamConnection return the string.

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.

Thanks, done in 7da9cce: dumpMissingUpstreamConnection now returns the string, and the ASSERT_TRUE streams it (gtest only evaluates the stream when the assertion fails).

(bot assisted)

`dumpMissingUpstreamConnection` returns the dump, which is streamed into
the `ASSERT_TRUE` (and so only built when it fails), rather than adding
its own failure before the assertion.

Signed-off-by: Ryan Northey <[email protected]>
@ravenblackx

Copy link
Copy Markdown
Contributor

/retest (I flaked during your deflake so you can deflake while you deflake: https://github.com/envoyproxy/envoy/actions/runs/43914182683/job/133463916675)

@phlax

phlax commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

closing - the flake was wai - we now have the evidence

cc @derekargueta

@phlax phlax closed this Nov 16, 2026
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.

3 participants