-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Cluster: worker.disconnect waits for handles to close before firing "disconnect" event #4542
Labels
cluster
Issues and PRs related to the cluster subsystem.
Comments
I've also been able to trigger this error after a worker disconnects:
|
What version of Node are you using? What operating system? You're a lot more likely to get help if you provide code (with no external dependencies) to reproduce the problem. |
I've been unable to reproduce the issue using a simple example, so I'm closing this issue. |
This was referenced Sep 15, 2021
This was referenced Dec 6, 2023
This was referenced Dec 6, 2023
This was referenced Dec 7, 2023
This was referenced Dec 7, 2023
This was referenced Dec 7, 2023
This was referenced Dec 7, 2023
This was referenced Dec 8, 2023
This was referenced Dec 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the classic (0.10) cluster scheduler (SCHED_NONE), when
worker.disconnect()
is called, the worker immediately emits a "disconnect" event, then proceeds to wait for exiting connections to close before terminating the child process:node/lib/cluster.js
Line 404 in f299d87
In the Round Robin mode,
worker.disconnect()
does not fire a disconnect event, and it waits for all the handles to close before disconnecting the child process.node/lib/cluster.js
Line 655 in f299d87
In short, the old behavior was to: 1) fire "disconnect", 2) wait for handles to close, 3) fire "exit". The new behavior is 1) disconnect IPC (but don't fire "disconnect" event), 2) wait for handles to close, 3) fire "disconnect" event, 4) fire "exit" event
The scenario I'm looking at is if a worker disconnects, I'd like the master to immediately start a new worker in its place, while waiting for the previous worker to terminate (or force terminate it if it takes too long to close on its own).
This was possible with the old scheduler, but not the round robin scheduler.
The text was updated successfully, but these errors were encountered: