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

Improve wait_actor_pool_recovered #2328

Merged
merged 3 commits into from
Aug 14, 2021

Conversation

keyile
Copy link
Contributor

@keyile keyile commented Aug 13, 2021

What do these changes do?

This PR enhances reliability of wait_actor_pool_recovered and avoid waiting forever. The changes are small and the ideas are below:

  1. The message handler creates the event and waits for it, so it can always retrieve the event (will not get None).
  2. The monitor pops and sets the recover event at every end of iterations, so the message handler will not wait forever.
  3. The monitor checks the existence at the start of iteration, to ensure the event will not be set too early.

This PR also adds tests for auto-recover and server-closed for ray as mars pool does.

Related issue number

Resolve #2320

if self._auto_recover and message.address not in self._recover_events:
self._recover_events[message.address] = asyncio.Event()
if self._auto_recover and message.address not in self._recover_events:
self._recover_events[message.address] = asyncio.Event()
Copy link
Member

@wjsi wjsi Aug 13, 2021

Choose a reason for hiding this comment

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

I think one single event object plus a lock is enough. Recover event is created during pool initialization and replaced with a new event object every time when a monitor loop finishes.

@qinxuye qinxuye added mod: actor type: enhancement request to be backported Indicate that the PR need to be backported to stable branch labels Aug 13, 2021
@qinxuye qinxuye added this to the v0.8.0a2 milestone Aug 13, 2021
Copy link
Collaborator

@qinxuye qinxuye left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@wjsi wjsi left a comment

Choose a reason for hiding this comment

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

LGTM

@wjsi wjsi merged commit 2fb00d8 into mars-project:master Aug 14, 2021
@keyile keyile deleted the add_test_for_ray_pool branch August 14, 2021 07:50
qinxuye pushed a commit to qinxuye/mars that referenced this pull request Aug 18, 2021
qinxuye pushed a commit to qinxuye/mars that referenced this pull request Aug 18, 2021
@wjsi wjsi added backported already PR has been backported and removed to be backported Indicate that the PR need to be backported to stable branch labels Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] wait_actor_pool_recovered can never return in some cases
3 participants