Repository navigation
Conversation
Retain the application iterable so completion, reset, and teardown invoke its close method exactly once, including when iter() returns another object. Log application cleanup errors without preventing connection teardown. Add nine lifecycle cases covering native teardown, immediate generator cleanup, completion, persistent reuse, and cleanup exceptions. Validation: 56 HTTP tests pass. Full suite: 266 pass, one skipped, with the same seven filesystem-fixture failures as the unpatched baseline.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the WSGI response lifecycle changes.
No open issues 🎉
What changed in this PR
This PR strengthens WSGI response lifecycle handling in the native HTTP server, releasing application resources and preventing failed streams from receiving a successful chunked terminator.
Changes:
- Track and close application iterables exactly once across completion, reset, teardown, and error paths.
- Add regression tests for cleanup, persistent connections, iterator creation errors, and write failures during headers, body, and final-chunk transmission.
| File | Description |
|---|---|
tests/core/http/test_wsgi_lifecycle.py |
Tests iterable cleanup, failure handling, teardown, and connection reuse. |
src/hio/core/http/serving.py |
Adds iterable ownership, repeat-safe cleanup, and error-path handling. |
Review effort: Balanced
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
Close WSGI response iterables on completion, connection teardown, reset, and error paths. Close failed streaming connections without sending a successful chunked terminator.
Keep the native and Pyodide CI jobs on Python 3.14, constrain
multidictto the major version that preserves HIO's duplicate-key contract, and retry a TCP connection when the socket reports a transient not-connected error while resolving its peer.Validation
multidict7.2.1 and passed with 6.9.1; the updated dependency constraint resolves to 6.9.1.pip-licenseswas not installed.