Repository navigation
Closed
Labels
deadlockThe cluster appears to not make any progress
Description
Traceback (most recent call last):
File "/home/runner/work/distributed/distributed/distributed/worker.py", line 3975, in validate_task
self.validate_task_fetch(ts)
File "/home/runner/work/distributed/distributed/distributed/worker.py", line 3917, in validate_task_fetch
assert ts.who_has
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/share/miniconda3/envs/dask-distributed/lib/python3.10/site-packages/tornado/ioloop.py", line 741, in _run_callback
ret = callback()
File "/usr/share/miniconda3/envs/dask-distributed/lib/python3.10/site-packages/tornado/ioloop.py", line 765, in _discard_future_result
future.result()
File "/home/runner/work/distributed/distributed/distributed/worker.py", line 1191, in handle_scheduler
await self.handle_stream(comm, every_cycle=[self.ensure_communicating])
File "/home/runner/work/distributed/distributed/distributed/core.py", line 625, in handle_stream
handler(**merge(extra, msg))
File "/home/runner/work/distributed/distributed/distributed/worker.py", line 1916, in handle_compute_task
self.transitions(recommendations, stimulus_id=stimulus_id)
File "/home/runner/work/distributed/distributed/distributed/worker.py", line 2621, in transitions
self.validate_task(ts)
File "/home/runner/work/distributed/distributed/distributed/worker.py", line 3985, in validate_task
raise AssertionError(
AssertionError: Invalid TaskState encountered for <TaskState "('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)" fetch>.
Story:
[("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'compute-task', 'compute-task-1650128700.1081934', 1650128700.1481702), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'released', 'waiting', 'waiting', {"('rechunk-split-77b7d884d5a5f48f375d62bb7d136665', 1333)": 'fetch'}, 'compute-task-1650128700.1081934', 1650128700.1482384), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'waiting', 'ready', 'ready', {}, 'ensure-communicating-1650128700.1599193', 1650128700.2175784), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'ready', 'executing', 'executing', {}, 'compute-task-1650128696.340246', 1650128700.218642), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'put-in-memory', 'compute-task-1650128696.340246', 1650128700.268273), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'executing', 'memory', 'memory', {"('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 251)": 'executing'}, 'compute-task-1650128696.340246', 1650128700.268321), ('free-keys', ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)",), 'processing-released-1650128700.5942154', 1650128701.1206636), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'release-key', 'processing-released-1650128700.5942154', 1650128701.1[2067](https://github.com/dask/distributed/runs/6048720092?check_suite_focus=true#step:11:2067)46), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'memory', 'released', 'released', {"('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)": 'forgotten'}, 'processing-released-1650128700.5942154', 1650128701.1[2073](https://github.com/dask/distributed/runs/6048720092?check_suite_focus=true#step:11:2073)92), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'released', 'forgotten', 'forgotten', {}, 'processing-released-1650128700.5942154', 1650128701.1[2075](https://github.com/dask/distributed/runs/6048720092?check_suite_focus=true#step:11:2075)35), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'ensure-task-exists', 'released', 'compute-task-1650128701.1707418', 1650128701.1864583), ("('rechunk-merge-77b7d884d5a5f48f375d62bb7d136665', 0, 333)", 'released', 'fetch', 'fetch', {}, 'compute-task-1650128701.1707418', 1650128701.1865091)]This was found by the new test_chaos_rechunk test.
Metadata
Metadata
Assignees
Labels
deadlockThe cluster appears to not make any progress
Activity
crusaderky commentedon Apr 24, 2022
This looks familiar:
mrocklin commentedon Apr 24, 2022
This failed again yesterday in CI. Copying the story here for easier reading
mrocklin commentedon Apr 24, 2022
This also occurred in the same test run
mrocklin commentedon Apr 24, 2022
Ensure_task_exists is new to me. @crusaderky it looks like you might also have some familiarity here. The thing that confuses me here is this shift:
fjetter commentedon Apr 25, 2022
This is basically a debug log that prints the state of a task whenever it is encountered as a dependency. The log you posted tells us that the task was properly, cleanly forgotten, i.e. all state should have been purged during the forgotten transition.
It was encountered as a new dependency (or task to compute) and since it wasn't known it starts in
released.I suspect
update_who_has. I'll try to reproduce and have a lookfjetter commentedon Apr 25, 2022
I can easily reproduce errors running the
test_chaos_rechunkbut it appears to not fail for me. Exceptions are just logged. Is this what others observe as well? The linked CI build appears to fail because of a wrong occupancy calculationcrusaderky commentedon Apr 25, 2022
indeed test_chaos_rechunk can't fail. See my comment #6123 (comment)
mrocklin commentedon Apr 25, 2022
mrocklin commentedon Apr 25, 2022
mrocklin commentedon Apr 25, 2022
Aside from the issue around raising errors (which I think may be fixed above) do folks have thoughts on the actual exception?
fjetter commentedon Apr 25, 2022
I could trace this to a race condition where a task is assigned and released frequently on a worker. The task is in memory for a time but released again.
ultimately, the worker receives a request like
even though
barisforgottenon the worker, i.e. definitely not in memory. I came across something like this already in #4784 which led me to introducedistributed/distributed/worker.py
Lines 3184 to 3192 in 198522b
self.addressfromwho_hassuch that it it empty then.I think we should simply transition the task to missing in this case which would then cause the scheduler to properly correct the state. I'm currently trying to narrow this behavior down a bit better by reducing a test case.
mrocklin commentedon Apr 25, 2022
Punting problems like these back to the scheduler and letting it have another try sounds like a good strategy in general.
fjetter commentedon Apr 26, 2022
I dug a bit deeper since something in the logs appeared to be off. Particularly, why the key is forgotten in the first place. Using #6161 I could track this down to a transition triggered by
register-worker. Inspecting the events shows a sequence likeI am a bit confused and worried why the worker is added (and removed) twice. The chaos code should let the worker connect and after it dies disconnect. I don't understand why it reconnects. The reconnection seems to put us into the corrupt state. I think the missing-data events are not related