Skip to content

fix(event-handler): stop recursive HTTP error handler dispatch - #5703

Merged
svozza merged 1 commit into
mainfrom
fix/5702-error-handler-loop
Sep 12, 2026
Merged

fix(event-handler): stop recursive HTTP error handler dispatch#5703
svozza merged 1 commit into
mainfrom
fix/5702-error-handler-loop

Conversation

@svozza

@svozza svozza commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

An async error handler rethrowing a matching HTTP error could repeatedly invoke itself, preventing the request from completing and eventually exhausting memory. Error resolution now calls each registered handler at most once per chain and returns the current HTTP error's built-in response when dispatch would revisit a handler.

Changes

  • Replace recursive error dispatch with an iterative loop that tracks handler identity locally to each resolution.
  • Preserve delegation to different handlers, HTTP status codes and messages, and isolation between concurrent requests.
  • Add buffered and streaming regressions for rethrows, fresh error instances, cycles between handlers, shared handlers, and concurrent requests. Twenty regression cases fail against the original implementation.
  • Document the fallback behavior and validate types, linting, and unit tests with 100% coverage.

Issue number: closes #5702


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@svozza
svozza merged commit 4fbfc3e into main Sep 12, 2026
43 checks passed
@svozza
svozza deleted the fix/5702-error-handler-loop branch September 12, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L PRs between 100-499 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Async HTTP error handlers can recurse until timeout or memory exhaustion

2 participants