Repository navigation
Integration test deflake attempt - #47096
Merged
Merged
Conversation
Signed-off-by: Raven Black <[email protected]>
ravenblackx
marked this pull request as ready for review
August 31, 2026 21:55
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Contributor
Author
|
/retest |
Signed-off-by: Raven Black <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
Contributor
Author
|
/retest |
Signed-off-by: Raven Black <[email protected]>
Contributor
Author
|
/retest |
Contributor
Author
Contributor
Author
|
/retest |
Contributor
Author
Accommodated. |
phlax
approved these changes
Sep 3, 2026
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> Backport note: only this change's own additions; the `deferred_read_enable` constructor argument and `FakeHttpConnection::initialize()` that `main` had before it are not on this branch. `cleanupUpstreamAndDownstream()` is as on `main` after it. (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> Backport note: only this change's own additions; the `deferred_read_enable` constructor argument and `FakeHttpConnection::initialize()` that `main` had before it are not on this branch. `cleanupUpstreamAndDownstream()` is as on `main` after it. (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> Backport note: only this change's own additions; the `deferred_read_enable` constructor argument and `FakeHttpConnection::initialize()` that `main` had before it are not on this branch. `cleanupUpstreamAndDownstream()` is as on `main` after it. (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> Backport note: only this change's own additions; the `deferred_read_enable` constructor argument and `FakeHttpConnection::initialize()` that `main` had before it are not on this branch. `cleanupUpstreamAndDownstream()` is as on `main` after it. (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> Backport note: only this change's own additions; the `deferred_read_enable` constructor argument and `FakeHttpConnection::initialize()` that `main` had before it are not on this branch. `cleanupUpstreamAndDownstream()` is as on `main` after it. (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> Backport note: only this change's own additions; the `deferred_read_enable` constructor argument and `FakeHttpConnection::initialize()` that `main` had before it are not on this branch. `cleanupUpstreamAndDownstream()` is as on `main` after it. (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
that referenced
this pull request
Nov 17, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> Backport note: only this change's own additions; the `deferred_read_enable` constructor argument and `FakeHttpConnection::initialize()` that `main` had before it are not on this branch. `cleanupUpstreamAndDownstream()` is as on `main` after it. (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 18, 2026
Commit Message: Integration test deflake attempt Additional Description: The specific integration test this is targeting was `test/extensions/filters/http/on_demand:on_demand_integration_test`, which is flaky about 1/1000. An example failure can be seen [here](https://github.com/envoyproxy/envoy/actions/runs/33410166780/job/99547577287) or [here](https://mordenite.cluster.engflow.com/actions/executions/ChB2N1ZVMpJHK4_9l1Z-2xVzEgdkZWZhdWx0GiUKINCPT4uyt_PlqlFcPUOCGYYfgQpXTBSMrjzdX1EDoaPVEKADIAAoAQ==). ``` [ RUN ] IpVersionsClientType/OnDemandVhdsIntegrationTest.MultipleUpdates/IPv4_EnvoyGrpc_Unified_Rds [2026-08-31 15:58:17.696][59507][critical][assert] [test/integration/http_integration.cc:574] assert failure: 0. Details: Timed out waiting for new connection. [2026-08-31 15:58:17.696][59507][error][envoy_bug] [./source/common/common/assert.h:60] stacktrace for envoy bug [2026-08-31 15:58:17.735][59507][error][envoy_bug] [./source/common/common/assert.h:64] #0 Envoy::HttpIntegrationTest::waitForNextUpstreamConnection() [0x56186bb8a1a9] [2026-08-31 15:58:17.756][59507][error][envoy_bug] [./source/common/common/assert.h:64] #1 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb88308] [2026-08-31 15:58:17.782][59507][error][envoy_bug] [./source/common/common/assert.h:64] #2 Envoy::HttpIntegrationTest::waitForNextUpstreamRequest() [0x56186bb8ab31] [2026-08-31 15:58:17.797][59507][error][envoy_bug] [./source/common/common/assert.h:64] #3 Envoy::(anonymous namespace)::OnDemandVhdsIntegrationTest_MultipleUpdates_Test::TestBody() [0x56186ba2b865] [2026-08-31 15:58:17.814][59507][error][envoy_bug] [./source/common/common/assert.h:64] #4 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f366344] [2026-08-31 15:58:17.829][59507][error][envoy_bug] [./source/common/common/assert.h:64] #5 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34af86] [2026-08-31 15:58:17.849][59507][error][envoy_bug] [./source/common/common/assert.h:64] #6 testing::Test::Run() [0x56186f332347] [2026-08-31 15:58:17.868][59507][error][envoy_bug] [./source/common/common/assert.h:64] #7 testing::TestInfo::Run() [0x56186f332c31] [2026-08-31 15:58:17.884][59507][error][envoy_bug] [./source/common/common/assert.h:64] #8 testing::TestSuite::Run() [0x56186f3333ca] [2026-08-31 15:58:17.900][59507][error][envoy_bug] [./source/common/common/assert.h:64] #9 testing::internal::UnitTestImpl::RunAllTests() [0x56186f340f53] [2026-08-31 15:58:17.915][59507][error][envoy_bug] [./source/common/common/assert.h:64] #10 testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x56186f368d34] [2026-08-31 15:58:17.932][59507][error][envoy_bug] [./source/common/common/assert.h:64] #11 testing::internal::HandleExceptionsInMethodIfSupported<>() [0x56186f34cfd6] [2026-08-31 15:58:17.948][59507][error][envoy_bug] [./source/common/common/assert.h:64] #12 testing::UnitTest::Run() [0x56186f34085b] [2026-08-31 15:58:17.965][59507][error][envoy_bug] [./source/common/common/assert.h:64] #13 RUN_ALL_TESTS() [0x56186df8b9a1] [2026-08-31 15:58:17.982][59507][error][envoy_bug] [./source/common/common/assert.h:64] #14 Envoy::TestRunner::runTests() [0x56186df8af59] [2026-08-31 15:58:17.998][59507][error][envoy_bug] [./source/common/common/assert.h:64] #15 main [0x56186df88e20] ``` The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem. The explanation is, `cleanupUpstreamAndDownstream()` previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection. For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's *really* cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns. HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events. For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case. Risk Level: Test-only. Testing: Yes it is. Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Raven Black <[email protected]> Backport note: only this change's own additions; the `deferred_read_enable` constructor argument and `FakeHttpConnection::initialize()` that `main` had before it are not on this branch. `cleanupUpstreamAndDownstream()` is as on `main` after it. (cherry picked from commit 9a1cf7c) Signed-off-by: Ryan Northey <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Message: Integration test deflake attempt
Additional Description: The specific integration test this is targeting was
test/extensions/filters/http/on_demand:on_demand_integration_test, which is flaky about 1/1000. An example failure can be seen here or here.The theory of this fix is from a deep AI inspection using GPT Sol. I understand what the change is doing and have reviewed it, but I wouldn't bet heavily on it actually fixing the problem.
The explanation is,
cleanupUpstreamAndDownstream()previously waited only for the fake upstream’s local socket close. This did not guarantee that Envoy’s worker had received the FIN and removed the connection from its HTTP connection pool. A subsequent request could therefore briefly reuse the closed connection instead of creating a new one, causing waitForNextUpstreamConnection() to time out as the request never provokes a new connection.For TCP upstreams, this cleanup now half-closes the fake upstream and waits for Envoy to close the reverse direction, thereby proving Envoy observed the shutdown so it's really cleaned up. It then runs a worker-thread barrier that effectively drains the events in the dispatchers, to ensure Envoy’s connection-close callbacks have removed the old pool client, before cleanup returns.
HTTP/3 still retains the previous behavior because QUIC does not support half-close, so the same race-flake might still be available if any test uses HTTP/3 upstreams with a similar sequence of events.
For some cases where half-close isn't supported, the worker-barrier is still included, which may suffice to make even those cases less flaky, given that the flakiness this targets was already around a 1/1000 case.
Risk Level: Test-only.
Testing: Yes it is.
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a