Skip to content

Use simulated time with http3, in OverloadIntegrationTest - #49120

Merged
ravenblackx merged 13 commits into
envoyproxy:mainfrom
ravenblackx:simtime
Nov 11, 2026
Merged

ravenblackx merged 13 commits into
envoyproxy:mainfrom
ravenblackx:simtime

Conversation

@ravenblackx

@ravenblackx ravenblackx commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Commit Message: Use simulated time with http3, in OverloadIntegrationTest
Additional Description:
This makes OverloadIntegrationTest take less than half as long.

This has gone a bit beyond the original scope; in order to support simulated time in http3 we needed the TimeSource to be initialized to nonzero, because some http3 code treats zero time as not yet initialized (or we needed to give it special treatment in http3 test context, which would have just been confusing in the long run, or it needed that production code touched, and I really wanted to keep this test-only). So that change required updating a whole mess of tests because they relied on time being initialized as zero rather than operating on deltas (which they should have always been).

Then I also rolled in a 5 second default timeout for waits on I/O so test failures are prompt and useful rather than "test timed out" hard to debug, but that timeout required even more tests to be updated because some of them relied on taking five seconds to resolve. As a result this change will also make several other integration tests complete more quickly.

And a comedy one, token buckets with time initialized to 1 second happened to round down their floating point numbers, where when they initialized to 0 seconds the floating point numbers rounded up. The tests shouldn't have been relying on floating point precision to that extent, so now they add an extra microsecond to ensure floating point imprecision doesn't prevent receiving a whole token when it's expected.

Risk Level: test-only
Testing: yes it is
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

@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: #49120 was opened by ravenblackx.

see: more, trace.

@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.

Mostly looks right, a few specific things below. The main one is the per-spin time advance; the rest are smaller.

If useful, we can run a tsan/asan deflake of the touched suites (overload, multiplexed simtime, fcds) on envoy-ci-staging against this branch before it merges, rather than finding out on main.

(bot assisted)

Comment thread test/test_common/test_time_system.h Resolved
Comment thread test/integration/http_integration.h Resolved
Comment thread test/integration/BUILD Resolved
ravenblackx added a commit that referenced this pull request Nov 11, 2026
Commit Message: [tests] Don't rely on fake monotonic time starting at
epoch 0
Additional Description: Currently many tests rely on the fake monotonic
time running from zero. This is misleading and can lead to fragile
tests; time should be relative. It's also incompatible with using fake
monotonic time in http3 contexts because some http3 code uses zero-time
to mean the timer is uninitialized.
This changes the default to starting at 1 second, so we can't
incorrectly rely on zero-epoch and so it can be used with http3, and
updates all the tests that relied on it starting at 0 to use relative
time, including the fragile test of token buckets, in which the behavior
of floating point rounding changes when the start time changes.
This is a split from PR #49120.
Risk Level: test-only
Testing: yes
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>

@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 @ravenblackx

@ravenblackx
ravenblackx merged commit 200d9d2 into envoyproxy:main Nov 11, 2026
25 checks passed
@ravenblackx
ravenblackx deleted the simtime branch November 11, 2026 22:29
phlax added a commit that referenced this pull request Nov 16, 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]>
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.

2 participants