Skip to content
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

[Fix][Core] Use asyncio.Event instead of AsyncioActorExit exception to terminate async actor #49918

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MortalHappiness
Copy link
Member

@MortalHappiness MortalHappiness commented Jan 17, 2025

Why are these changes needed?

When an asyncio task creates another asyncio task, raising AsyncioActorExit cannot make the caller exit because they are not the same task. Therefore, this PR removes the AsyncioActorExit custom exception and uses asyncio.Event for synchronization among multiple asyncio tasks. This ensures that even if the user creates a different asyncio task and calls exit_actor within it, the actor can still exit correctly.

Related issue number

Closes: #49451

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@MortalHappiness MortalHappiness added the go add ONLY when ready to merge, run all tests label Jan 17, 2025
@MortalHappiness MortalHappiness force-pushed the bugfix/#49451-exit-actor-async-background branch from 714b3ca to d634e66 Compare January 17, 2025 14:17
@MortalHappiness MortalHappiness force-pushed the bugfix/#49451-exit-actor-async-background branch from 7184694 to a1fa8ac Compare January 17, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] ray.actor.exit_actor() does not seem to work from within an async background thread
1 participant