-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
worker.exitedAfterDisconnect is false, after the worker process has exited using process.exit() #28837
Comments
https://nodejs.org/api/cluster.html#cluster_worker_exitedafterdisconnect
The behaviour you describe is exactly what is documented. Neither kill() or disconnect() was called in your situation, the worker called exit(), so exitedAfterDisconnect is false. |
But shouldn't it be undefined as documented. .kill() or .disconnect() has not been called |
Should we fix it at the documentation level or fix the code? |
It's repeatedly normalized from truthy/falsy to true/false: I strongly suspect current behaviour is an improvement, but the docs need updating. Also, I wonder, is the initial value |
Okay I will see what I can find and get back |
Yeah I checked out the git history to this PR #3743 Yeah, it was an improvement over .suicide |
@nimit95 Please PR a fix, thanks. |
The defaul value of worker.exitedAfterDisconnect is undefined. If the worker dies on its own the value is changed to false and doesn't remains undefined. While the documentation just mentions 'Set by calling .kill() or .disconnect(). Until then, it is undefined.'. Making the default value as false in worker.js Fixes: nodejs#28837 Refs: nodejs#3743
Fixed the documentaion to reflect the changes in the default value of worker.exitedAfterDisconnect Fixes: nodejs#28837 Refs: nodejs#3743
The test checka for the exit code of the worker. cluster on exit must be called. And the value for exitedAfterDisconnect should be false Fixes: nodejs#28837 Refs: nodejs#3743
fixed the test that checked for default value undefined to false and renamed the test that checks for the value exitedAfterDisconnect if the worker exits on its own. Fixes: nodejs#28837 Refs: nodejs#3743
Fixed the documentation to reflect the changes in the default value of worker.exitedAfterDisconnect Fixes: nodejs#28837 Refs: nodejs#3743
Version: 10.16.0
Platform: 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64
Call process.exit() in worker/child, in master log the value after any worker exit
The text was updated successfully, but these errors were encountered: