From 08ebbb31cf57701032ee0111380e588f48922bca Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 14 Jun 2017 19:32:18 +0200 Subject: [PATCH] cluster: remove deprecated problematic API Content Warning: mental health and self-harm triggers. --- The word "suicide" was used in the cluster API 4 years ago. This was a serious mistake for several reasons. It was deprecated in version 6, and long past time for full removal now. First, and most important, casual use of words referring to self-harm serve to stigmatize mental illness and make it harder for people in our community to literally stay alive. It is impossible to claim that we intend to be inclusive and welcoming, and also casually show such disrespect for the lives of those in our community. Some of us have lost friends or struggled with mental illness. Leaving this lying around tells us that we are not welcome. Second, in addition to being just wildly inappropriate on ethical and community grounds, the term "suicide" was never even appropriate technically! In context, it refers to a case where a child process exits without receiving a fatal signal from the parent process. The "cute" unix joke here is that the process "killed itself". However, the "suicide" flag is set regardless of how the process exited, so in addition to being offensive and harmful, it is also misleading and incorrect, and has always been so. (It could've thrown an error, called `process.exit()` or received a fatal signal from some other process.) An open source project is not the place for emotional landmines. It's distracting and misleading at best, and actively harmful at worst. There is no justification for it. The API has already been renamed, and it's an obscure surface that is unlikely to ever be used outside of core. --- doc/api/cluster.md | 34 ------------------- doc/api/deprecations.md | 10 ------ lib/internal/cluster/worker.js | 14 -------- ...st-cluster-disconnect-afterexited-race.js} | 0 .../test-cluster-worker-constructor.js | 4 +-- .../test-cluster-worker-deprecated.js | 8 ++--- .../test-cluster-worker-disconnect.js | 4 --- test/parallel/test-cluster-worker-exit.js | 2 -- test/parallel/test-regress-GH-3238.js | 4 +-- 9 files changed, 8 insertions(+), 72 deletions(-) rename test/parallel/{test-cluster-disconnect-suicide-race.js => test-cluster-disconnect-afterexited-race.js} (100%) diff --git a/doc/api/cluster.md b/doc/api/cluster.md index c7d8359ac0ce93..721b33a7e184f1 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -451,40 +451,6 @@ if (cluster.isMaster) { } ``` -### worker.suicide - - -> Stability: 0 - Deprecated: Use [`worker.exitedAfterDisconnect`][] instead. - -An alias to [`worker.exitedAfterDisconnect`][]. - -Set by calling `.kill()` or `.disconnect()`. Until then, it is `undefined`. - -The boolean `worker.suicide` is used to distinguish between voluntary -and accidental exit, the master may choose not to respawn a worker based on -this value. - -```js -cluster.on('exit', (worker, code, signal) => { - if (worker.suicide === true) { - console.log('Oh, it was just voluntary – no need to worry'); - } -}); - -// kill worker -worker.kill(); -``` - -This API only exists for backwards compatibility and will be removed in the -future. - ## Event: 'disconnect'