Skip to content

http2: deflake DownstreamConnectionDurationTimeoutTriggersFloodProtection - #49209

Merged
phlax merged 1 commit into
envoyproxy:mainfrom
phlax:flood-conn-duration-deflake
Nov 12, 2026
Merged

phlax merged 1 commit into
envoyproxy:mainfrom
phlax:flood-conn-duration-deflake

Conversation

@phlax

@phlax phlax commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

The test sets max_connection_duration to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see http2.outbound_frames_active at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and http2.outbound_flood already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

#28733 reported the same failure on the same variant in 2023.

Fixes #28733

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

…tion

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the test-only change aimed at reducing HTTP/2 connection-duration test flakiness.

No open issues 🎉

What changed in this PR

Reduces timing-related flakiness in the HTTP/2 connection-duration flood-protection test, addressing #28733 without changing production behavior.

Changes:

  • Extracts sendPrefillRequest() to send the pre-fill request without waiting for the queue to fill.
  • Updates the duration-timeout test to wait directly for disconnect, preserving the existing helper behavior for other tests.
File Description
test/​integration/​http2_flood_integration_test.cc Separates request setup from queue-state waits to avoid racing with the connection-duration timer.

Review effort: Balanced

@phlax
phlax merged commit 0dfc464 into envoyproxy:main Nov 12, 2026
25 checks passed
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

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

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

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

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit that referenced this pull request Nov 17, 2026
…tion (#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

#28733 reported the same failure on the same variant in 2023.

Fixes #28733

Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
…tion (envoyproxy#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

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

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

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

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit 0dfc464)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit that referenced this pull request Nov 17, 2026
…tion (#49209)

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

#28733 reported the same failure on the same variant in 2023.

Fixes #28733

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

The test sets `max_connection_duration` to 1s and then pre-fills the
downstream outbound queue. The duration timer runs from when the
connection is made, so it also covers the pre-fill, and the pre-fill
helper waits to see `http2.outbound_frames_active` at exactly 1000. If
the timer fires before the test thread has seen that, the GOAWAY
overflows the queue and the connection closes, which is what the test
is after, but the gauge drops to 0 and the helper times out with
"current value 0" and `http2.outbound_flood` already at 1.

This splits sending the pre-fill request out of the helper, and the
test uses that and waits for the disconnect, without waiting on the
state of the queue in between. The response and the GOAWAY are one
frame over the limit together, so nothing has to be seen before the
timer fires. The other users of the helper do not change.

Additional Description:
Seen under tsan on IPv4Oghttp2. The test takes about 2s there, so the
pre-fill normally fits in the second with little to spare. It did not
reproduce in 1000 runs of the test or 100 runs of the suite under tsan
on a quiet cluster. Stalling the test thread for 1.5s after the
pre-fill request is sent reproduces the exact symptom in 20 of 20 runs
on all four variants.

With this change the test passes 500 of 500 runs under tsan. It also
passes 20 of 20 with a 1.5s stall before the socket is blocked, and 20
of 20 with the stall after that but before the request is sent, so it
holds when the timer fires first.

envoyproxy#28733 reported the same failure on the same variant in 2023.

Fixes envoyproxy#28733

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

http2_flood_integration_test: DownstreamConnectionDurationTimeoutTriggersFloodProtection fails sporadically

3 participants