Skip to content

Who_has missing - Fix deadlock triggered by a failed gather_dep attempt after task has been rescheduled already - #5786

Merged
crusaderky merged 5 commits into
dask:mainfrom
fjetter:fix_who_has_missing
Feb 11, 2022
Merged

crusaderky merged 5 commits into
dask:mainfrom
fjetter:fix_who_has_missing

Conversation

@fjetter

@fjetter fjetter commented Feb 9, 2022 •

Copy link
Copy Markdown
Member

@github-actions

github-actions Bot commented Feb 10, 2022 •

Copy link
Copy Markdown
Contributor

Unit Test Results

       18 files  +       6         18 suites  +6   9h 52m 25s ⏱️ + 3h 25m 23s
  2 596 tests +       3    2 514 ✔️ +     15       79 💤  -   12  3 ❌ ±0 
23 230 runs  +7 720  21 741 ✔️ +7 126  1 486 💤 +594  3 ❌ ±0 

For more details on these failures, see this check.

Results for commit 5b6187e. ± Comparison against base commit 65f4151.

♻️ This comment has been updated with latest results.

@fjetter fjetter left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am sill trying to figure out a test but at least the flaky once are fixed on my machine.
Before this fix they failed after ~20 iterations and now it's stable after about a thousand runs.

Comment thread distributed/scheduler.py
Comment on lines +4377 to +4378
self.log_event(address, {"action": "add-worker"})
self.log_event("all", {"action": "add-worker", "worker": address})

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Moving these to the beginning of the transaction helps debugging causation a bit

Comment thread distributed/scheduler.py
Comment on lines +4995 to +4996
event_msg["worker"] = address
self.log_event("all", event_msg)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not having the worker in the all events makes the entire message useless. I wouldn't mind having the redundancy of the key in the worker specific topic but we made a difference for add-worker as well so I aligned.

Comment thread distributed/scheduler.py
if ws is not None and ws in ts._who_has:
parent.remove_replica(ts, ws)
if not ts._who_has:
if ts.state == "memory" and not ts._who_has:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this ts.state == "memory" check should not be necessary but it is definitely correct. Otherwise I could see race conditions being introduced by stale signals, e.g. worker is indeed still alive or reconnected but the task is already in process on a different worker. It wouldn't have any who has but we wouldn't want it to be rescheduled

@fjetter

fjetter commented Feb 10, 2022

Copy link
Copy Markdown
Member Author

I think this also resolves a few "accidental" task rescheduling events. I'm kind of surprised this didn't cause any more issues. Maybe it did and we misdiagnosed or missed it.
At the very least in adaptive/downscaling scenarios I could imagine this leading to some instability.

@chrisroat I remember you running into these kind of problems. This may interest you but I can't promise anything

@fjetter fjetter changed the title WIP Fix who_has missing thing Who_has missing - Fix deadlock triggered by a failed gather_dep attempt after task has been rescheduled already Feb 10, 2022
@fjetter
fjetter marked this pull request as ready for review February 10, 2022 14:01
@fjetter
fjetter requested a review from crusaderky February 10, 2022 14:01
await a.close()
write_event.set()

await f1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

main deadlocks here

@fjetter fjetter mentioned this pull request Feb 10, 2022
1 of 2 tasks

@crusaderky crusaderky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks!

@crusaderky
crusaderky merged commit de43b17 into dask:main Feb 11, 2022
@fjetter
fjetter deleted the fix_who_has_missing branch February 11, 2022 13:04
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.

2 participants