From 747253ba00d1bb633f98556cf971631cccbffe7a Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 19 Jul 2018 13:50:12 -0700 Subject: [PATCH] Protect against infinite loops Flag that we provided a notification and ignore it if it attempts to come back up. Signed-off-by: Ralph Castain (cherry picked from commit ea0d70bc9396def61545e2ce492a55c4c3aa7772) --- orte/orted/pmix/pmix_server_gen.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/orte/orted/pmix/pmix_server_gen.c b/orte/orted/pmix/pmix_server_gen.c index 8993a6cdf0f..2c9d7326fb2 100644 --- a/orte/orted/pmix/pmix_server_gen.c +++ b/orte/orted/pmix/pmix_server_gen.c @@ -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); @@ -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 */ @@ -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);