Repository navigation
Conversation
Motivation HTTP/2 flow control counts the full received DATA payload, while the entity exposes only its content. Modification Carry padding overhead separately from application bytes. Apply window accounting before and after request entity dispatch without charging buffered bytes twice. Reuse the existing batching policy for discarded padding. Result Receive windows reflect the DATA payload while entity bytes and Content-Length remain unchanged. References RFC 9113 sections 6.1 and 6.9.1.
Motivation HTTP/2 DATA received for a closed stream can still consume the connection-level receive window even when the stream discards it. Modification Debit the full flow-controlled size without retaining entity bytes or updating the closed stream. Keep other streams' buffered bytes reserved and replenish connection credit through the existing batching policy. Use the existing connection-error path when credit is insufficient. Check the connection-only credit in the existing cancellation test before checking that a subsequent exchange still succeeds. Result Discarding DATA no longer leaves the connection's receive accounting out of sync with the peer. The stream remains closed. References RFC 9113 sections 5.1, 6.4 and 6.9.
He-Pin
force-pushed
the
fix/http2-closed-stream-data-receive-credit
branch
from
November 26, 2026 17:11
fe4813e to
77dbbe8
Compare
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.
Motivation
When HTTP/2 discards DATA after a stream has closed, those bytes still count toward the connection's receive window.
Modification
Count the complete DATA payload once in the existing closed-stream handling path. Apply the normal connection-level credit update policy without retaining entity bytes, granting stream-level credit, or reopening the stream.
Result
Discarded DATA is accounted for at the connection level without changing entity delivery or stream-level flow control.
Tests
On JDK 17, 14 focused tests passed on each of Scala 2.13.18 and 3.3.9. MiMa passed. Full CI was not run locally.
References
Dependency
Stacked on apache/pekko-http#1666. Since this upstream draft targets
main, GitHub's full diff includes the dependency until it merges. Review the follow-up commit only. This draft will be rebased onmainafter #1666 merges and should not merge before then.