-
Notifications
You must be signed in to change notification settings - Fork 5.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
[core] On GCS restart, destroy not forget the unused workers. Fixing PG leaks. #45854
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
Signed-off-by: Ruiyang Wang <rywang014@gmail.com>
rynewang
force-pushed
the
destroy-unused-workers
branch
2 times, most recently
from
June 11, 2024 21:42
9585d20
to
547658e
Compare
jjyao
reviewed
Jun 11, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Lets add some tests
Co-authored-by: Jiajun Yao <jeromeyjj@gmail.com> Signed-off-by: Ruiyang Wang <56065503+rynewang@users.noreply.github.com>
Co-authored-by: Jiajun Yao <jeromeyjj@gmail.com> Signed-off-by: Ruiyang Wang <56065503+rynewang@users.noreply.github.com>
Co-authored-by: Jiajun Yao <jeromeyjj@gmail.com> Signed-off-by: Ruiyang Wang <56065503+rynewang@users.noreply.github.com>
jjyao
approved these changes
Jun 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On GCS restart, it prunes any worker it did not bookkeep, via the RPC
ReleaseUnusedWorkers
. Raylet receives it and removes any workers not in aworker_ids_in_use
list. However, it's only forgetting the worker by removing it from theleased_workers_
not killing the worker, but the worker can be still in running and never gets killed, hence leaked.The evidence leading to this PR is, in a Ray cluster I observed GCS failed to kill a placement group: it sends "pls remove all workers in this PG", and raylet did not kill any workers, and then it finds the PG is still in used and replied "failed, pls retry" for many minutes, and finally GCS gave up and the PG is removed from the GCS, and the worker leaked. I found the PG holding worker is NOT in leased_workers_, but it IS known by worker_pool, since it shows up in worker pool's state dump.
The reason behind the above case is, when GCS is restarting, it wrongly thinks the worker is no longer needed (due to another bug (#45791 actors whose parent is detached actor is considered dead but should be alive), and orders Raylet to release it. Raylet, as fixed in this PR, simply forgets the worker but does not kill it.
To make things more clear, here is a timeline:
Parent
, which creates a PGpg
and a normal actorChild
in pgParent
dies. Everyone should live on, since everyone's lifetime = detached Parent'sChild
should be die, and,ReleaseUnusedWorkers
to Raylet with this worker as "not used"Note since FIX1 (#45791) is merged, Raylet should no longer kill the detached actor on RPC because it's considered used. This FIX2 is just for the sake of completeness, and for future leaks.
In this PR:
ReleaseUnusedWorkers
, instead of forgetting the workers we call DestroyWorker to kill itReleaseWorkers
methodReleaseUnusedActorWorkers
to make it dead clear.Fixes #45598.