From 9018dffd7fe47913d60a18bb995ca1cd253fc087 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Mon, 15 May 2017 23:47:15 -0700 Subject: [PATCH] Fix bug in actor task dispatch. (#552) * Fix bug in actor task dispatch. * Return early from dispatch_actor_task if creation notification has not arrived. Also fix comment. --- src/local_scheduler/local_scheduler_algorithm.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/local_scheduler/local_scheduler_algorithm.cc b/src/local_scheduler/local_scheduler_algorithm.cc index 8fa0d20cf..24149df5b 100644 --- a/src/local_scheduler/local_scheduler_algorithm.cc +++ b/src/local_scheduler/local_scheduler_algorithm.cc @@ -295,7 +295,11 @@ bool dispatch_actor_task(LocalSchedulerState *state, /* Make sure this worker actually is an actor. */ CHECK(!ActorID_equal(actor_id, NIL_ACTOR_ID)); /* Make sure this actor belongs to this local scheduler. */ - CHECK(state->actor_mapping.count(actor_id) == 1); + if (state->actor_mapping.count(actor_id) != 1) { + /* The creation notification for this actor has not yet arrived at the local + * scheduler. This should be rare. */ + return false; + } CHECK(DBClientID_equal(state->actor_mapping[actor_id].local_scheduler_id, get_db_client_id(state->db))) @@ -914,14 +918,14 @@ void handle_actor_task_scheduled(LocalSchedulerState *state, ActorID actor_id = TaskSpec_actor_id(spec); DCHECK(!ActorID_equal(actor_id, NIL_ACTOR_ID)); if (state->actor_mapping.count(actor_id) == 1) { + DCHECK(DBClientID_equal(state->actor_mapping[actor_id].local_scheduler_id, + get_db_client_id(state->db))); + } else { /* This means that an actor has been assigned to this local scheduler, and a * task for that actor has been received by this local scheduler, but this * local scheduler has not yet processed the notification about the actor * creation. This may be possible though should be very uncommon. If it does * happen, it's ok. */ - DCHECK(DBClientID_equal(state->actor_mapping[actor_id].local_scheduler_id, - get_db_client_id(state->db))); - } else { LOG_INFO( "handle_actor_task_scheduled called on local scheduler but the " "corresponding actor_map_entry is not present. This should be rare.");