Skip to content

Fix datasets leaking worker processes due to closure capture of stats actor handle#22156

Merged
ericl merged 2 commits intoray-project:masterfrom
ericl:fix-ds-leak
Feb 7, 2022
Merged

Fix datasets leaking worker processes due to closure capture of stats actor handle#22156
ericl merged 2 commits intoray-project:masterfrom
ericl:fix-ds-leak

Conversation

@ericl
Copy link
Copy Markdown
Contributor

@ericl ericl commented Feb 6, 2022

Why are these changes needed?

It looks like an actor handle was closure captured in one of the remote tasks. This prevents the workers of those tasks from exiting once the job finishes, since the reference counter is seeing live references.

This PR changes Datasets to avoid this code path. Separately @stephanie-wang I think ReferenceCounter::DrainAndShutdown() may need to be changed to ignore references that don't have any remote borrowers (in this case, an entry in the function table holding an actor reference doesn't seem like a reason to hold up shutdown).

Related issue number

Closes #22154

Copy link
Copy Markdown
Contributor

@clarkzinzow clarkzinzow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

assert ray.get(actor.method.remote()) == 1

# Tests datasets doesn't leak workers.
ray.data.range(100).map(lambda x: x).take()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to capture this in a unit test, or is it not worth it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little tricky, so I punted on it for now.

@ericl ericl merged commit 00b5801 into ray-project:master Feb 7, 2022
@rkooo567 rkooo567 mentioned this pull request Feb 9, 2022
6 tasks
rkooo567 added a commit that referenced this pull request Feb 9, 2022
After this PR (#22156), for some reasons the driver script has some string that cannot be encoded with ascii. It seems like using utf-8 solves the problem.
simonsays1980 pushed a commit to simonsays1980/ray that referenced this pull request Feb 27, 2022
simonsays1980 pushed a commit to simonsays1980/ray that referenced this pull request Feb 27, 2022
After this PR (ray-project#22156), for some reasons the driver script has some string that cannot be encoded with ascii. It seems like using utf-8 solves the problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Datasets] Datasets leak ray::IDLE processes

4 participants