Skip to content

HttpServerConnection: use exceptions for error handling #10006

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

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

julianbrost
Copy link
Contributor

When a HTTP connection dies prematurely while the response is sent, http::async_write() sets the error code to something like broken pipe for example. When calling async_flush() afterwards, it sometimes happens that this never returns. This results in a resource leak as the coroutine isn't cleaned up. This commit makes the individual functions throw exceptions instead of silently ignoring the errors, resulting in the function terminating early and also resulting in an error being logged as well.

When a HTTP connection dies prematurely while the response is sent,
`http::async_write()` sets the error code to something like broken pipe for
example. When calling `async_flush()` afterwards, it sometimes happens that
this never returns. This results in a resource leak as the coroutine isn't
cleaned up. This commit makes the individual functions throw exceptions instead
of silently ignoring the errors, resulting in the function terminating early
and also resulting in an error being logged as well.
@julianbrost julianbrost added bug Something isn't working area/api REST API consider backporting Should be considered for inclusion in a bugfix release labels Feb 19, 2024
@cla-bot cla-bot bot added the cla/signed label Feb 19, 2024
@julianbrost julianbrost merged commit af97431 into master Mar 8, 2024
@julianbrost julianbrost deleted the http-error-handling branch March 8, 2024 14:06
@yhabteab yhabteab added this to the 2.15.0 milestone Jun 7, 2024
@Al2Klimov Al2Klimov mentioned this pull request Jan 22, 2025
@Al2Klimov Al2Klimov added backported Fix was included in a bugfix release and removed consider backporting Should be considered for inclusion in a bugfix release labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api REST API backported Fix was included in a bugfix release bug Something isn't working cla/signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants