Skip to content

Settle WSGI producer exceptions truthfully - #28

Merged
kentbull merged 1 commit into
release/v0.6.20from
fix/http-producer-exception-settlement-v0.6.20
Aug 29, 2026
Merged

kentbull merged 1 commit into
release/v0.6.20from
fix/http-producer-exception-settlement-v0.6.20

Conversation

@kentbull

@kentbull kentbull commented Aug 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • place application invocation, iterator construction, and iterator advancement inside one response-settlement boundary
  • abort generic failures while retaining the original cause and closing the application-returned iterable
  • render pre-commit HTTP errors as finite responses and abort post-commit HTTP errors without changing queued bytes

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 HTTPError can 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.

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.
@kentbull
kentbull merged commit fde044a into release/v0.6.20 Aug 29, 2026
6 checks passed
@kentbull
kentbull deleted the fix/http-producer-exception-settlement-v0.6.20 branch August 29, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant