-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Signal handling improvements #329
base: master
Are you sure you want to change the base?
Conversation
Hi, @andywer any reason not to merge this? This fixes our issue as well. We've temporarily addressed this by doing :
But it is not really satisfying. |
10bece2
to
841f2ff
Compare
I dont think you should install any signal listeners it's dangerous and out of scope of the common library.. |
841f2ff
to
d72886a
Compare
Note that this PR doesn't add signal handling, it only attempts to improve the existing signal handling. Removing the signal handlers entirely is a topic that deserves discussion in a dedicated bug report. The scope of this PR is intentionally narrow to avoid breaking existing users. |
Can signal handling be provided by as an additional utility function that users can install? It's quite dangerous for the signal handlers to be installed upon import. |
I'm all for that, but it would require a major version bump. This PR attempts to preserve compatibility as much as possible so that it can be merged without delay (ping @andywer). My preference would be to merge this as-is, then open another PR that overhauls cleanup. Note that Node.js currently does not provide a robust way to perform cleanup actions, so there may never be a completely satisfactory solution. See nodejs/node#29480. |
The default signal handler always exits non-zero so the signal listener installed by threads.js should too.
This also suppresses any synchronous exceptions thrown by `worker.terminate()`.
The promise returned from `Promise.all()` immediately rejects if any of the underlying promises reject, even if some of the other promises have not yet settled. Catch each rejection to give the other promises an opportunity to resolve. `Promise.allSettled()` could be used instead, but that's a relatively new function that was added in Node.js v12.9.0.
d72886a
to
6c561d4
Compare
Multiple commits (intentionally separate, please do not squash):
This is intended as an alternative to pull request #324.