GeezerVison is showing github.com — doc: specify cluster worker.kill() caveat · nodejs/node@5836b9f
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/cluster.md +5Lines changed: 5 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -394,6 +394,11 @@ This function will kill the worker. In the master, it does this by disconnecting |
394 | 394 | the `worker.process`, and once disconnected, killing with `signal`. In the |
395 | 395 | worker, it does it by disconnecting the channel, and then exiting with code `0`. |
396 | 396 |
|
| 397 | +Because `kill()` attempts to gracefully disconnect the worker process, it is |
| 398 | +susceptible to waiting indefinitely for the disconnect to complete. For example, |
| 399 | +if the worker enters an infinite loop, a graceful disconnect will never occur. |
| 400 | +If the graceful disconnect behavior is not needed, use `worker.process.kill()`. |
| 401 | + |
397 | 402 | Causes `.exitedAfterDisconnect` to be set. |
398 | 403 |
|
399 | 404 | This method is aliased as `worker.destroy()` for backwards compatibility. |
|