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

Should we include an unhandledRejection handler? #469

Open
xjamundx opened this issue Jul 29, 2016 · 3 comments
Open

Should we include an unhandledRejection handler? #469

xjamundx opened this issue Jul 29, 2016 · 3 comments
Projects

Comments

@xjamundx
Copy link
Contributor

We currently have an uncaughtException handler of sorts in, https://github.com/krakenjs/kraken-js/blob/v2.x/middleware/shutdown.js

Would it be possibly to add a similar unhandledException handler? Would we want to do that here.

Now that promises are baked into node, I'm sure we'll see these being used more often.

@tlivings
Copy link
Member

The complexity I see here is that while we can capture unhandled exceptions in a domain, responding back to the client and beginning a graceful shutdown, an unhandled rejection will not be caught in the domain. Therefore adding a process.on('unhandledRejection') isn't going to be super useful from a general usage perspective.

@xjamundx
Copy link
Contributor Author

That's a fair point!

@grawk
Copy link
Member

grawk commented Jun 10, 2019

From experimentation I've seen that adding an unhandledRejection listener which emits SIGTERM will allow the server to drain traffic and shutdown gracefully.

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

No branches or pull requests

3 participants