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

throws in onSend hook never come back #409

Closed
BigMurry opened this issue Oct 31, 2017 · 0 comments · Fixed by #410
Closed

throws in onSend hook never come back #409

BigMurry opened this issue Oct 31, 2017 · 0 comments · Fixed by #410
Labels
bug Confirmed bug

Comments

@BigMurry
Copy link
Contributor

BigMurry commented Oct 31, 2017

onSend hook may has a cycle execution issue when calling next(new Error('some error')). For example:

fastify.addHook('onSend', function (request, reply, payload, next) {
  next(new Error('some error'));
})
fastify.get('/', function (request, reply) {
  // it will never get here.
})

if we start a GET / request, it'll timeout
As the current execution sequence is:
onSend next(some error) -> wrapOnSendEnd -> onSendEnd -> handleError -> onSend hook
If onSend throws error again, the upper execution will start again.

Create a PR #410

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants