Skip to content

Commit 1dadd80

Browse files
committed
fix vine_worker itable iteration bug on failed libraries
1 parent 3268ac0 commit 1dadd80

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

taskvine/src/worker/vine_worker.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -747,17 +747,21 @@ static void handle_failed_library_process(struct vine_process *p, struct link *m
747747
/* Forsake the tasks that are running on this library */
748748
/* It no available libraries on this worker, tasks waiting for this library will be forsaken */
749749

750-
struct vine_process *p_running;
751-
uint64_t task_id;
750+
uint64_t *task_ids = itable_keys_array(procs_running);
751+
int total_procs = itable_size(procs_running);
752+
753+
for (int i = 0; i < total_procs; i++) {
754+
uint64_t task_id = task_ids[i];
755+
struct vine_process *p_running = itable_lookup(procs_running, task_id);
752756

753-
ITABLE_ITERATE(procs_running, task_id, p_running)
754-
{
755757
if (p_running->library_process == p) {
756758
debug(D_VINE, "killing function task %d running on library task %d", (int)task_id, p->task->task_id);
757759
finish_running_task(p_running, VINE_RESULT_FORSAKEN);
758760
reap_process(p_running, manager);
759761
}
760762
}
763+
764+
itable_free_keys_array(task_ids);
761765
}
762766

763767
/*

0 commit comments

Comments
 (0)