mirror of
https://github.com/wassname/ray.git
synced 2026-08-02 13:01:01 +08:00
Fix actor creation hang due to race in SWAP queue (#6280)
This commit is contained in:
@@ -709,9 +709,9 @@ bool CoreWorker::AddActorHandle(std::unique_ptr<ActorHandle> actor_handle) {
|
||||
it->second->Reset();
|
||||
}
|
||||
} else if (actor_data.state() == gcs::ActorTableData::DEAD) {
|
||||
RAY_CHECK_OK(gcs_client_->Actors().AsyncUnsubscribe(actor_id, nullptr));
|
||||
// We cannot erase the actor handle here because clients can still
|
||||
// submit tasks to dead actors.
|
||||
// submit tasks to dead actors. This also means we defer unsubscription,
|
||||
// otherwise we crash when bulk unsubscribing all actor handles.
|
||||
}
|
||||
|
||||
direct_actor_submitter_->HandleActorUpdate(actor_id, actor_data);
|
||||
|
||||
@@ -2632,21 +2632,9 @@ void NodeManager::ForwardTask(
|
||||
task_entry.second.TaskData().GetTaskExecutionSpec().GetMessage());
|
||||
}
|
||||
|
||||
// Move the FORWARDING task to the SWAP queue so that we remember that we
|
||||
// have it queued locally. Once the ForwardTaskRequest has been sent, the
|
||||
// task will get re-queued, depending on whether the message succeeded or
|
||||
// not.
|
||||
local_queues_.QueueTasks({task}, TaskState::SWAP);
|
||||
client->ForwardTask(request, [this, on_error, task_id, node_id](
|
||||
client->ForwardTask(request, [this, on_error, task, task_id, node_id](
|
||||
Status status, const rpc::ForwardTaskReply &reply) {
|
||||
// Remove the FORWARDING task from the SWAP queue.
|
||||
Task task;
|
||||
TaskState state;
|
||||
if (!local_queues_.RemoveTask(task_id, &task, &state)) {
|
||||
return;
|
||||
}
|
||||
RAY_CHECK(state == TaskState::SWAP);
|
||||
|
||||
if (status.ok()) {
|
||||
const auto &spec = task.GetTaskSpecification();
|
||||
// Mark as forwarded so that the task and its lineage are not
|
||||
|
||||
Reference in New Issue
Block a user