Repository navigation
Fix HTTP/2 stalls when early responses leave unread request bodies - #395
Open
AdityaSreevatsaK wants to merge 1 commit into
Open
AdityaSreevatsaK wants to merge 1 commit into
AdityaSreevatsaK wants to merge 1 commit into
Conversation
…gjones#393) Release blocked ASGI input producers on response completion while preserving unread queued input during transport disconnect. Add asyncio and Trio queue regressions, HTTP/2 multiplexing coverage, and HTTP/1.1 half-close compatibility tests.
This branch has not been deployed
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.
Summary
Fixes #393.
When an ASGI application sends an early HTTP/2 response without consuming the request body, the bounded application input queue can become full.
Subsequent incoming DATA frames can then block the protocol reader, preventing other streams on the same connection from progressing and potentially delaying graceful shutdown.
This change ensures that completed or disconnected streams cannot indefinitely block the connection.
Changes
Regression Tests
Added coverage for:
Validation
Tested in the forked CI run - https://github.com/AdityaSreevatsaK/hypercorn/actions/runs/43695100109.
Results:
Known unrelated CI failures:
h2version rejects invalid CONNECT headers. This is separately addressed by fix(tests): add :protocol pseudo-header for Extended CONNECT in WebSo… #371.The implementation-specific regression tests pass across all five tested Python versions.
Scope
This change intentionally does not modify
protocol/h2.py.Handling DATA frames received after a stream has already been removed is a separate concern addressed by #391.
Thanks to @tahsinrk for the detailed reproduction in #393.