Skip to content

Commit e172849

Browse files
author
Ralph Castain
authored
Merge pull request #5457 from rhc54/topic/loop
Protect against infinite loops
2 parents 8a6dc0b + 747253b commit e172849

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

orte/orted/pmix/pmix_server_gen.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,17 @@ void pmix_server_notify(int status, orte_process_name_t* sender,
356356
}
357357
}
358358

359+
/* protect against infinite loops by marking that this notification was
360+
* passed down to the server by me */
361+
if (NULL == cd->info) {
362+
cd->info = OBJ_NEW(opal_list_t);
363+
}
364+
val = OBJ_NEW(opal_value_t);
365+
val->key = strdup("orte.notify.donotloop");
366+
val->type = OPAL_BOOL;
367+
val->data.flag = true;
368+
opal_list_append(cd->info, &val->super);
369+
359370
opal_output_verbose(2, orte_pmix_server_globals.output,
360371
"%s NOTIFYING PMIX SERVER OF STATUS %d",
361372
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ret);
@@ -382,6 +393,14 @@ int pmix_server_notify_event(int code, opal_process_name_t *source,
382393
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
383394
ORTE_NAME_PRINT(source), code);
384395

396+
/* check to see if this is one we sent down */
397+
OPAL_LIST_FOREACH(val, info, opal_value_t) {
398+
if (0 == strcmp(val->key, "orte.notify.donotloop")) {
399+
/* yep - do not process */
400+
goto done;
401+
}
402+
}
403+
385404
/* a local process has generated an event - we need to xcast it
386405
* to all the daemons so it can be passed down to their local
387406
* procs */
@@ -448,6 +467,7 @@ int pmix_server_notify_event(int code, opal_process_name_t *source,
448467
/* maintain accounting */
449468
OBJ_RELEASE(sig);
450469

470+
done:
451471
/* execute the callback */
452472
if (NULL != cbfunc) {
453473
cbfunc(ORTE_SUCCESS, cbdata);

0 commit comments

Comments
 (0)