Skip to content

Commit

Permalink
Merge pull request #5457 from rhc54/topic/loop
Browse files Browse the repository at this point in the history
Protect against infinite loops
  • Loading branch information
Ralph Castain authored Jul 19, 2018
2 parents 8a6dc0b + 747253b commit e172849
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions orte/orted/pmix/pmix_server_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,17 @@ void pmix_server_notify(int status, orte_process_name_t* sender,
}
}

/* protect against infinite loops by marking that this notification was
* passed down to the server by me */
if (NULL == cd->info) {
cd->info = OBJ_NEW(opal_list_t);
}
val = OBJ_NEW(opal_value_t);
val->key = strdup("orte.notify.donotloop");
val->type = OPAL_BOOL;
val->data.flag = true;
opal_list_append(cd->info, &val->super);

opal_output_verbose(2, orte_pmix_server_globals.output,
"%s NOTIFYING PMIX SERVER OF STATUS %d",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ret);
Expand All @@ -382,6 +393,14 @@ int pmix_server_notify_event(int code, opal_process_name_t *source,
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
ORTE_NAME_PRINT(source), code);

/* check to see if this is one we sent down */
OPAL_LIST_FOREACH(val, info, opal_value_t) {
if (0 == strcmp(val->key, "orte.notify.donotloop")) {
/* yep - do not process */
goto done;
}
}

/* a local process has generated an event - we need to xcast it
* to all the daemons so it can be passed down to their local
* procs */
Expand Down Expand Up @@ -448,6 +467,7 @@ int pmix_server_notify_event(int code, opal_process_name_t *source,
/* maintain accounting */
OBJ_RELEASE(sig);

done:
/* execute the callback */
if (NULL != cbfunc) {
cbfunc(ORTE_SUCCESS, cbdata);
Expand Down

0 comments on commit e172849

Please sign in to comment.