Conversation
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 15 files ±0 15 suites ±0 6h 17m 38s ⏱️ - 48m 17s Results for commit 3ffcf71. ± Comparison against base commit 1d0701b. ♻️ This comment has been updated with latest results. |
| w = _remove_from_processing(self, ts) | ||
|
|
||
| ts.erred_on.add(w or worker) # type: ignore | ||
| ts.erred_on.add(w) |
There was a problem hiding this comment.
IIUC this is what motivated your change. However, if _remove_from_processing returns None, we'd use worker instead. Is worker also None in this scenario? If so, is the kwarg even still in use?
There was a problem hiding this comment.
Since we encountered a None in ts.erred_on in #6874, there needs to be some scenario where both w and worker_ are None. I dropped the worker kwarg since it's not being used anywhere and will get collected in **kwargs.
There was a problem hiding this comment.
I'm a bit worried here about consistency.
The only way I am aware of to trigger this transition is by receiving a task-erred message from a worker
distributed/distributed/scheduler.py
Line 3093 in 1d0701b
which is handled by handle_worker which will always have a worker extra kwarg
distributed/distributed/scheduler.py
Line 4888 in 1d0701b
distributed/distributed/core.py
Line 842 in 1d0701b
i.e. calling handle_task_erred will always have worker as part of msg (proper signatures + mypy would help here)
distributed/distributed/scheduler.py
Lines 4756 to 4757 in 1d0701b
which leads us to the actual stimulus handler which I think should verify if the task-erred message actually originated from the worker the task is currently processing on which it doesn't
distributed/distributed/scheduler.py
Lines 4161 to 4190 in 1d0701b
The whole point of this is that if I read all of this correctly, w == worker is always True unless something went wrong earlier.
How worker=None can happen is something I do not understand
cc @crusaderky I believe you've been working on something similar recently?
There was a problem hiding this comment.
Ok, the worker=None is coming from
distributed/distributed/scheduler.py
Lines 4308 to 4315 in 1d0701b
therefore, the scenario of an empty ts.erred_on comes from tasks that have been transitioned to error because of a KilledWorker exception.
There was a problem hiding this comment.
therefore, the scenario of an empty ts.erred_on comes from tasks that have been transitioned to error because of a KilledWorker exception.
That makes sense, #6874 includes a bunch of KilledWorker exceptions.
|
I think there are a couple of things we should verify here.
should really be if ts is None or ts.state != "processing" or ts.processing_on != worker:
return {}, {}, {}it's very likely this is not tested
|
d410146 to
3ffcf71
Compare
Done.
I have added the assertion step for now, better safe than sorry. It's odd enough we ran into the |
|
|
||
| w = _remove_from_processing(self, ts) | ||
| if w: | ||
| if w in self.workers: |
There was a problem hiding this comment.
I'm a little concerned about this. It feels like another instance of #6392.
In #6614 (comment) I have a driveby refactor fixing a possible stale WorkerState in _remove_from_processing.
If we go ahead and return the address even if we know it's stale, then transition_processing_released here has no ability to verify whether w is stale or not, because it just has an address, not a WorkerState instance. It's possible that a worker left, then reconnected with the same address and port. If that's the case, we'd then be sending a free-keys to the wrong worker instance.
I'm wondering if instead of the approach in this PR, we should go back to the old behavior and instead explicitly handle the case in transition_processing_erred where both w and worker are None (i.e. the KilledWorker case)?
There was a problem hiding this comment.
Two thoughts:
- EDIT: Look at Withhold root tasks [no co assignment] #6614 (comment) & Always return
ws.addressfrom_remove_from_processing#6884 (comment)
IIUC, since we're not awaiting anywhere in, it should never happen thatdistributed/distributed/scheduler.py
Lines 2261 to 2262 in c15a10e
is True whiledistributed/distributed/scheduler.py
Line 7337 in c15a10e
is False. Thus, this piece of code should behave the same way as before. Am I missing something here?distributed/distributed/scheduler.py
Line 2262 in c15a10e
- Instead of handling the
Nonecase, should we maybe return the entireWorkerStateobject to ensure that users of_remove_from_processingcan check for stale worker states as you described? From your description, it sounds like returning a worker adress might generally not be all too helpful.
There was a problem hiding this comment.
Note: I wrote the previous response without looking at the linked comment. That drive-by fix makes sense to me. To solve the issue at hand, I'd return whatever
distributed/distributed/scheduler.py
Line 7333 in c15a10e
There was a problem hiding this comment.
I guess I don't like downstream users having to differentiate themselves (more points to mess that up). Returning None felt pretty sensible to me in that case. In the rare case where callers need to know the worker we thought it was processing on, even if that worker might be stale—I believe transition_processing_erred is the only case where this applies?—why not retrieve that explicitly first?
Did this happen? I'm not seeing it in the diff? I also disagree that it should be a no-op. We currently support an unexpected worker successfully competing a task: distributed/distributed/scheduler.py Lines 1987 to 1993 in c15a10e so we should also support an unexpected worker encountering an error with a task. (I do think both cases probably indicate something is going wrong and should eventually be removed, I just don't see why we'd be inconsistent about the |
It looks like I forgot to push that commit, it's on my local branch.
I think being inconsistent between |
Closes #6874
pre-commit run --all-files