Repository navigation
fix: allow retrying failed connection pool stream closures - #1330
Open
AdityaSreevatsaK wants to merge 12 commits into
Open
AdityaSreevatsaK wants to merge 12 commits into
AdityaSreevatsaK wants to merge 12 commits into
Conversation
Keep the pool request registered when an inner stream close fails, so a later close can release it safely. Cover sync and async retries.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
Reset inner response stream close state on failure for HTTP/1.1 and HTTP/2. Move retry regression checks into the generated async/sync connection-pool suites.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 7 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Avoid Ruff B009 violations from getattr on string literals in synchronous and asynchronous test variants.
Merging this PR will not alter performance
Comparing Footnotes
|
Prevent simulated close errors from masking request setup failures in the real HTTP/1.1 and HTTP/2 regression tests.
Core Request objects do not automatically synthesise a Host header, which HTTP/1.1 and HTTP/2 require for direct pool requests.
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 #1328.
PoolByteStreampreviously marked itself as closed before closing the underlying stream. If that operation raised an exception, subsequent close attempts were skipped, leaving the request registered in the connection pool.This PR fixes that behaviour for both synchronous and asynchronous streams by resetting
_closedwhen the underlying close fails, allowing a later attempt to retry.Pool cleanup still occurs only after the underlying stream closes successfully.
Testing:
BaseExceptionand idempotent cleanup.[Successful CI run](https://github.com/AdityaSreevatsaK/httpx2/actions/runs/43093935454)
Checklist