-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Server crashes if a requested aborted during sending a response. #4294
Comments
Thanks for the report! @kanongil I know you are looking at related areas of the codebase right now, so just wanted to put this on your radar. |
Thanks, this should already be handled by my incoming patch. Just need to create a test or two for this so we don't regress. |
@kanongil is there ETA for the patch release? Is there anything I can help you with to speed up the release? |
I believe I have a fix, but still working on a creating a test that fails with the current version. ETA for PR is sometimes today. |
I managed to create a test case. I have a PR in #4295. |
Support plan
Context
What are you trying to achieve or the steps to reproduce?
I spent the whole day struggling with the flaky integration tests that were caused by unhandled promise rejection in Hapi sever when an incoming request is aborted.
The server crashes with
What I learned from the code inspection so far:
Request aborted
https://github.com/hapijs/hapi/blob/master/lib/request.js#L728I guess it might happen because of a discrepancy between
response
andresponse.request.response
content intransmit
method https://github.com/hapijs/hapi/blob/master/lib/transmit.js#L28I worked around the problem locally by adding the next snippet at the very top of
transmit
.I don't think it's a proper fix but I don't know Hapi codebase to address the problem on my own so I'd appreciate any hints from the maintainers before I can open a PR.
Might be related to #4244 (comment) but the issue doesn't mention any problems with runtime errors.
What was the result you got?
Hapi crashes if an incoming request is aborted while the server is sending a response.
What result did you expect?
Hapi handles the
abort
event gracefully.The text was updated successfully, but these errors were encountered: