diff options
author | cjihrig <cjihrig@gmail.com> | 2018-09-29 12:22:15 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2018-10-04 09:02:47 -0400 |
commit | a5c27091cc4db6b2d9cc49de3ef9ed06dddcd5f2 (patch) | |
tree | c7582ffe18d219dc43f83e7789ce02ac3e17b11d /doc/api/cluster.md | |
parent | 1fd99b4ac7f73f46017b459d9a8b99fcb37bcf93 (diff) | |
download | android-node-v8-a5c27091cc4db6b2d9cc49de3ef9ed06dddcd5f2.tar.gz android-node-v8-a5c27091cc4db6b2d9cc49de3ef9ed06dddcd5f2.tar.bz2 android-node-v8-a5c27091cc4db6b2d9cc49de3ef9ed06dddcd5f2.zip |
doc: specify cluster worker.kill() caveat
worker.kill() relies on a graceful disconnect, which might not
always be possible. This commit calls this out in the docs, and
specifies worker.process.kill() as a non-graceful alternative.
PR-URL: https://github.com/nodejs/node/pull/23165
Fixes: https://github.com/nodejs/node/issues/22703
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'doc/api/cluster.md')
-rw-r--r-- | doc/api/cluster.md | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 54b470e0f0..868d52be88 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -394,6 +394,11 @@ This function will kill the worker. In the master, it does this by disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by disconnecting the channel, and then exiting with code `0`. +Because `kill()` attempts to gracefully disconnect the worker process, it is +susceptible to waiting indefinitely for the disconnect to complete. For example, +if the worker enters an infinite loop, a graceful disconnect will never occur. +If the graceful disconnect behavior is not needed, use `worker.process.kill()`. + Causes `.exitedAfterDisconnect` to be set. This method is aliased as `worker.destroy()` for backwards compatibility. |