Repository navigation
Who_has missing - Fix deadlock triggered by a failed gather_dep attempt after task has been rescheduled already - #5786
Conversation
Unit Test Results 18 files + 6 18 suites +6 9h 52m 25s ⏱️ + 3h 25m 23s 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
left a comment
There was a problem hiding this comment.
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.
| self.log_event(address, {"action": "add-worker"}) | ||
| self.log_event("all", {"action": "add-worker", "worker": address}) |
There was a problem hiding this comment.
Moving these to the beginning of the transaction helps debugging causation a bit
| event_msg["worker"] = address | ||
| self.log_event("all", event_msg) |
There was a problem hiding this comment.
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.
| 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: |
There was a problem hiding this comment.
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
|
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. @chrisroat I remember you running into these kind of problems. This may interest you but I can't promise anything |
| await a.close() | ||
| write_event.set() | ||
|
|
||
| await f1 |
pre-commit run --all-files