Settle WSGI producer exceptions truthfully - #28
Merged
kentbull merged 1 commit intoAug 29, 2026
Merged
Conversation
Catch failures while invoking the application, constructing its iterator, and advancing response production so each path reaches an explicit terminal outcome. Render HTTPError only before response commitment, close the application-returned iterable before replacement output, and abort without rewriting queued bytes after commitment.
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
Why
WSGI response production crosses three executable boundaries: calling the application, constructing the returned iterable iterator, and advancing that iterator. If an exception escapes or is only logged at any boundary, HIO cannot truthfully distinguish an active response from a failed one and may retain application resources. The HTTP commitment boundary also changes the only safe outcome: before headers, an
HTTPErrorcan become the response; after headers, replacing the response would corrupt the wire stream, so production must abort without rewriting queued bytes.Tracks ioflo#193. The upstream port is deferred behind ioflo#179, ioflo#181, ioflo#191, and ioflo#192. Body and terminal-frame enqueue failures remain isolated for the next unit.