Skip to content

fix: destroy response when errors occur after headers are flushed - #1431

Open
Slmpire wants to merge 1 commit into
CalloraOrg:mainfrom
Slmpire:fix/destroy-socket-on-error-after-headers
Open

Slmpire wants to merge 1 commit into
CalloraOrg:mainfrom
Slmpire:fix/destroy-socket-on-error-after-headers

Conversation

@Slmpire

@Slmpire Slmpire commented Sep 30, 2026 •

Copy link
Copy Markdown

Summary

Fix error handling for streaming responses when the response headers have already been sent.

What Changed

Updated the error handling flow to properly terminate the response when errors occur after headers have been sent, including failures during proxy streaming and SSE handling.

Previously, errorHandler returned without ending the response when res.headersSent was true, which could leave connections open with truncated responses.

Impact

Prevents clients from hanging until their timeout.

Ensures partial streaming responses are properly terminated.

Prevents incomplete upstream responses from being treated as complete.

Helps avoid server-side socket/resource leaks.

Related Issue

closes #1277

Copilot AI balanced review requested due to automatic review settings September 30, 2026 12:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Destroy sockets when errors occur after headers flush

2 participants