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

Handle stream payload errors before socket connection #225

Merged
merged 3 commits into from
Aug 17, 2018

Conversation

ggoodman
Copy link
Contributor

#223 introduced a small window between the creation of the request and the socket connection wherein error events on the payload would have no attached handler and could cause uncaught exceptions.

This PR includes a regression test as well as the fix:

  • Attach a temporary error handler to the options.payload whose piping has been deferred
  • When such error events happen, re-emit the error on the req itself and allow this to clean itself up

Open questions:

  • should we remove the socket listener in onStreamError?
  • should we even be using req.emit('error', err) as the mechanism to propagate the error?
  • will things be correctly cleaned up for errors so-emitted?

@geek geek added the bug Bug or defect label Jul 24, 2018
@geek geek added this to the 14.0.3 milestone Jul 24, 2018
@geek geek self-assigned this Jul 24, 2018
@geek geek merged commit eaf9d9b into hapijs:master Aug 17, 2018
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants