Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix body-writer exception causes hang #532

Open
wants to merge 1 commit into
base: stable
Choose a base branch
from

Conversation

mrstux
Copy link

@mrstux mrstux commented Nov 8, 2022

A sufficiently complex body-writer may not be able to complete writing the body, and the only practical approach is to throw an exception.

Exceptions are normally thrown from body-writers when the socket is closed by the remote peer.

If a Raw response body-writer throws an exception before completing the body the http session will be left out of sync and will hang indefinitely waiting to read the next request. The fix results in the socket being closed and not attempting to read the next request when an error occurs. If a content-length is provided then the network error can be detected by the remote peer, otherwise a truncated body is returned to the client.

@mrstux mrstux force-pushed the fix-body-writer-exception-handling branch 2 times, most recently from 8c9387b to ab8b51a Compare November 8, 2022 04:45
A sufficiently complex body-writer may not be able to complete writing
the body, and the only practical approach is to throw an exception.

Exceptions are normally thrown from body-writers when the socket is
closed by the remote peer.

If a Raw response body-writer throws an exception before completing the
body the http session will be left out of sync and will hang
indefinitely waiting to read the next request. The fix results in the
socket being closed and not attempting to read the next request when an
error occurs. If a content-length is provided then the network error
can be detected by the remote peer, otherwise a truncated body is
returned to the client.
@mrstux mrstux force-pushed the fix-body-writer-exception-handling branch from ab8b51a to 9ad8a89 Compare November 8, 2022 04:46
@mrstux
Copy link
Author

mrstux commented Nov 8, 2022

branched from 1.5.0. Simply merging stable will resolve above conflicts.

@mrstux mrstux force-pushed the fix-body-writer-exception-handling branch 2 times, most recently from 21ebb16 to 9ad8a89 Compare November 8, 2022 04:59
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