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 3 commits into from Aug 17, 2018


Copy link

ggoodman commented Jul 24, 2018

#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 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
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.