Skip to content

fix: quic stream buffer underflow on HTTP/3 Request#46250

Open
yuehaii wants to merge 6 commits into
envoyproxy:mainfrom
yuehaii:quic-filter-underflowed
Open

fix: quic stream buffer underflow on HTTP/3 Request#46250
yuehaii wants to merge 6 commits into
envoyproxy:mainfrom
yuehaii:quic-filter-underflowed

Conversation

@yuehaii

@yuehaii yuehaii commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Commit Message:
quiche's WriteOrBufferData on any stream never goes through ScopedWatermarkBufferUpdater, so reported_buffered_bytes_ can lag behind BufferedDataBytes() whenever quiche writes directly.

Additional Description:
the fix move clearWatermarkBuffer() from both subclasses into the base class EnvoyQuicStream which owns the private member reported_buffered_bytes_, and change the drain argument from BufferedDataBytes() to reported_buffered_bytes_.

the reported_buffered_bytes_ tracks exactly what this stream has contributed to bytes_to_send_. it is incremented and decremented exclusively through updateBytesBuffered, which is only called from ScopedWatermarkBufferUpdater. the quiche internal writes bypass ScopedWatermarkBufferUpdater, so they are never counted in reported_buffered_bytes_.

Risk Level:
Low

Fixes #46087

yuehaii added 2 commits July 18, 2026 20:52
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
@paul-r-gall

Copy link
Copy Markdown
Contributor
  1. Please add tests
  2. CI failure looks related.

Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
@paul-r-gall

Copy link
Copy Markdown
Contributor

/retest

@paul-r-gall

Copy link
Copy Markdown
Contributor

@yuehaii Thank you for the PR. I am going to convert this to a draft; please convert back when you have added tests.

@paul-r-gall
paul-r-gall marked this pull request as draft July 21, 2026 13:39
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
@yuehaii
yuehaii marked this pull request as ready for review July 23, 2026 03:44
@yuehaii

yuehaii commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@yuehaii Thank you for the PR. I am going to convert this to a draft; please convert back when you have added tests.

hi @paul-r-gall , I have added the test case. please help review the pr when it is convenient. thanks.

yuehaii added 2 commits July 23, 2026 20:44
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
@yuehaii

yuehaii commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

still "Run rm -rf "$TMP_STDOUT"" related CI failure
/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants