Skip to content

test/overload: Fix flaky Http1SafeMaxConnectionDuration - #49258

Merged
phlax merged 2 commits into
envoyproxy:mainfrom
phlax:overload-http1-safe-max-duration-flake
Nov 16, 2026
Merged

phlax merged 2 commits into
envoyproxy:mainfrom
phlax:overload-http1-safe-max-duration-flake

Conversation

@phlax

@phlax phlax commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Commit Message: test/overload: Fix flaky Http1SafeMaxConnectionDuration
Additional Description:

Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit tsan:
https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response (overload_integration_test.cc:701). With trace logs, Envoy encodes the response with connection: close and starts closing the downstream connection with the response still buffered (closing data_to_write=157), arming the 10ms delayed close timer from the integration test defaults. That timer runs on simulated time (#49120) and can fire before the connection gets a write event, which with an HTTP/3 upstream is busy on the same worker. Envoy then closes the socket without writing the response, and the client sees the connection close instead.

Disable the delayed close timeout in this test, so that the connection closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, *Http1SafeMaxConnectionDuration*, 1000 runs:

  • main (cacf8e2): 74/1000 failed, all at overload_integration_test.cc:701, all HTTP/1 downstream with HTTP/3 upstream
  • this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

@phlax phlax changed the title test/overload: Disable the delayed close timeout in Http1SafeMaxConne… test/overload: Fix flaky Http1SafeMaxConnectionDuration Nov 14, 2026
@phlax
phlax requested a balanced review from Copilot November 15, 2026 18:30

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 reported for the test-only timeout adjustment intended to reduce flakiness.

No open issues 🎉

What changed in this PR

This test-only change addresses flakiness in Http1SafeMaxConnectionDuration, particularly with HTTP/1 downstream and HTTP/3 upstream connections, while preserving overload-duration coverage.

Changes:

  • Disables the delayed-close timeout so the final response can finish flushing before connection closure.
  • Adds a comment explaining how simulated time can trigger closure before the response is written.
File Description
test/​integration/​overload_integration_test.cc Disables the timeout in the affected test and documents the reason.

Review effort: Balanced

// Close the connection only once the final response has been written. A delayed close
// timer runs on simulated time and can fire before the response is written, so the
// client would see the connection close instead of the response.
cm.mutable_delayed_close_timeout()->set_nanos(0);

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.

Suggested change
cm.mutable_delayed_close_timeout()->set_nanos(0);
cm.mutable_delayed_close_timeout()->CopyFrom(ProtobufUtil::TimeUtil::SecondsToDuration(0));

(It's more readable and accurate than only setting nanos which could potentially leave seconds>0.)

Also the line of code above uses MergeFrom for this, which does nothing, so should either be removed or replaced with CopyFrom. (MergeFrom only copies "set" values, and in proto3 values holding their default value are considered "unset", so MergeFrom({0,0}) will leave the target message unchanged.)

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 8815172: both lines now use CopyFrom. The drain timeout was already 0s before this, because mutable_drain_timeout() makes the field present, so neither line changes behaviour.

(bot assisted)

Set the drain and delayed close timeouts to 0s with `CopyFrom`, which
is clearer and sets both fields of the duration. `MergeFrom` of a 0s
duration copies nothing (the default values are not set in proto3), so
it only worked because `mutable_` had already made the field present.

Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax merged commit b3812bd into envoyproxy:main Nov 16, 2026
26 checks passed
phlax added a commit to phlax/envoy that referenced this pull request Nov 16, 2026
…9258)

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit b3812bd)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit that referenced this pull request Nov 17, 2026
`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

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

`Protocols/OverloadScaledTimerIntegrationTest.Http1SafeMaxConnectionDuration`
flakes for HTTP/1 downstream with an HTTP/3 upstream, e.g. in postsubmit
tsan:

https://github.com/envoyproxy/envoy/actions/runs/43524148177/job/132225692414

The second request gets a reset instead of its response
(`overload_integration_test.cc:701`). With trace logs, Envoy encodes the
response with `connection: close` and starts closing the downstream
connection with the response still buffered (`closing
data_to_write=157`), arming the 10ms delayed close timer from the
integration test defaults. That timer runs on simulated time (envoyproxy#49120)
and can fire before the connection gets a write event, which with an
HTTP/3 upstream is busy on the same worker. Envoy then closes the socket
without writing the response, and the client sees the connection close
instead.

Disable the delayed close timeout in this test, so that the connection
closes once the response has been written.

Risk Level: low (test only)
Testing:

Deflake, tsan, `*Http1SafeMaxConnectionDuration*`, 1000 runs:

- main (cacf8e2): 74/1000 failed, all at
`overload_integration_test.cc:701`, all HTTP/1 downstream with HTTP/3
upstream
- this PR (33fd513): 0/1000 failed

Docs Changes: n/a
Release Notes: n/a

---------

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit b3812bd)
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.

3 participants