Repository navigation
Fix HTTP/2 response stalls behind concurrent network reads - #1334
Open
AdityaSreevatsaK wants to merge 2 commits into
Open
AdityaSreevatsaK wants to merge 2 commits into
AdityaSreevatsaK wants to merge 2 commits into
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
Contributor
There was a problem hiding this comment.
1 issue found across 5 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/httpcore2/test_http2_read_dispatch.py">
<violation number="1" location="tests/httpcore2/test_http2_read_dispatch.py:53">
P3: This comment describes the old read-lock queueing, but waiting streams now block on the `_read_event` completion event, not `_read_lock`. Update it to match the mechanism the test relies on.</violation>
</file>
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 #1300.
Under concurrent HTTP/2 requests, a response can remain undelivered even after its events have been received and queued. Another stream may acquire the shared read lock and block on a subsequent network read, delaying an already-completed response.
Changes
Testing
Full test suite passed: Python 3.11–3.15.
CI: https://github.com/AdityaSreevatsaK/httpx2/actions/runs/43293561851
Security: https://github.com/AdityaSreevatsaK/httpx2/actions/runs/43293561652
Related work
PR #1298 refactors HTTP/2 stream ownership and modifies overlapping code. This change focuses specifically on coordinating network reads and waking streams with queued events.
The implementation has been prepared separately to allow review and integration with the ongoing HTTP/2 work.
Checklist
Documentation was not changed because the fix corrects internal scheduling behaviour.
Prepared with AI assistance. The changes and test results have been reviewed.