Repository navigation
fix(streaming): interrupt blocked synchronous SSE reads - #37
Merged
Merged
Conversation
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
Closing a synchronous Session or Thread SSE subscription from another thread could leave the reader blocked until the server sent more data or the read timeout expired. Interrupt an active HTTP/1.x socket read before releasing its response to the pool so
close()promptly ends the subscription without reconnecting.Why
Installed-package Thread SSE acceptance reproduced this on the real HTTPX transport in both Forward and Managed. Existing mock streams woke readers in their own
close()implementation and did not expose the issue. The fix is shared by Session and Thread streams and preserves keep-alive reuse after a fully consumed response.Verification
uv run make lintuv run make typecheckuv run make test: 4,319 passed; 73 account-backed integration cases deselecteduv run make docs-check: generated documentation and 34 README snippets passed--helpsmoke checks: 26 passedCommands and results:
The installed wheel is a local candidate, not a replacement internal QA artifact. After merge, rerun the internal validation pipeline and accept its new package before preparing version PRs. Python 3.13 and Linux are left to the existing GitHub CI matrix.
Impact
CHANGELOG.mdunderUnreleased..env.live, logs, certificates, or generated test output committed.HTTP/2 sockets can be shared across requests and are never interrupted. HTTP/2 and custom transports without an exposed native socket retain their transport's close behavior; the README documents this boundary.