[core] Reset next_task_reply_position
when the actor restarts to avoid submitting the same task twice
#52759
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
Currently, we don't update the
next_task_reply_position
correctly. Hence, some tasks may belong to both out_of_order_completed_tasks and requests.That is, when a actor restarts and calls
ConnectActor
, some tasks may be submitted by bothResendOutOfOrderCompletedTasks
(out_of_order_completed_tasks) andSendPendingTasks
(requests).ray/src/ray/core_worker/transport/actor_task_submitter.cc
Lines 334 to 335 in 96a632d
However, the Ray task status transitions to a different state during the first submission (
ResendOutOfOrderCompletedTasks
), so the second task submission (i.e.,SendPendingTasks
) fails on the following line.ray/src/ray/core_worker/task_manager.cc
Line 1436 in 96a632d
Example
Add more details for the above statement. For example,
seq_no
: 0-99) to Actor A.seq_no
(0 ~ 3). The driver callsSequentialActorSubmitQueue::MarkSeqnoCompleted
4 times to updatenext_task_reply_position
to 4.seq_no
: 100 ~ 199)seq_no
(100 ~ 103). However, becausenext_task_reply_position
is 4, these 4 tasks are put intoout_of_order_completed_tasks
.seq_no
: 200 ~ 299). At the same time, the tasks (100 - 103) in theout_of_order_completed_tasks
have already been updated toseq_no
(200 - 203).ConnectActor
out_of_order_completed_tasks
andrequests
.Reproduction
Run the test without this PR
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.