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

Prevent race condition in P2P shuffle run manager #8262

Merged
merged 6 commits into from Oct 13, 2023

Conversation

hendrikmakait
Copy link
Member

@hendrikmakait hendrikmakait commented Oct 12, 2023

There is a potential race condition in P2P shuffling between the stream-based shuffle_fail and the RPC-based get and get_or_create. This race can cause a worker to cache a stale shuffle run locally and tasks to perform their work on a stale run. This PR prevents this.

  • Tests added / passed
  • Passes pre-commit run --all-files

Comment on lines 203 to +204
) -> ShuffleRun:
# FIXME: This should never be ToPickle[ShuffleRunSpec]
result: ShuffleRunSpec | ToPickle[ShuffleRunSpec]
if spec is None:
result = await self._plugin.worker.scheduler.shuffle_get(
id=shuffle_id,
worker=self._plugin.worker.address,
)
else:
result = await self._plugin.worker.scheduler.shuffle_get_or_create(
spec=ToPickle(spec),
key=key,
worker=self._plugin.worker.address,
)
if isinstance(result, ToPickle):
result = result.data
result = await self._fetch(shuffle_id=shuffle_id, spec=spec, key=key)
Copy link
Member Author

Choose a reason for hiding this comment

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

This code has been moved into _fetch

@hendrikmakait hendrikmakait added shuffle bug Something is broken labels Oct 12, 2023
@github-actions
Copy link
Contributor

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

       21 files  +       1         21 suites  +1   10h 44m 28s ⏱️ + 45m 47s
  3 859 tests +       1    3 745 ✔️  -        2     107 💤 ±  0    7 +3 
37 307 runs  +1 393  35 480 ✔️ +1 325  1 803 💤 +62  24 +6 

For more details on these failures, see this check.

Results for commit 19cca42. ± Comparison against base commit cb3da26.

@hendrikmakait hendrikmakait added the needs review Needs review from a contributor. label Oct 12, 2023
Copy link
Collaborator

@crusaderky crusaderky left a comment

Choose a reason for hiding this comment

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

very minor notes

distributed/shuffle/_worker_plugin.py Outdated Show resolved Hide resolved
key=key,
worker=self._plugin.worker.address,
)
if isinstance(result, ToPickle):
Copy link
Collaborator

Choose a reason for hiding this comment

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

out of scope: I'm not sure I understand why this may or may not be wrapped in ToPickle?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's something in the comms, haven't dug too deep into it.

distributed/shuffle/_worker_plugin.py Outdated Show resolved Hide resolved
hendrikmakait and others added 2 commits October 13, 2023 12:58
Co-authored-by: crusaderky <crusaderky@gmail.com>
Co-authored-by: crusaderky <crusaderky@gmail.com>
@hendrikmakait hendrikmakait merged commit be23012 into dask:main Oct 13, 2023
17 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken needs review Needs review from a contributor. shuffle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants