diff --git a/opal/mca/pmix/base/pmix_base_fns.c b/opal/mca/pmix/base/pmix_base_fns.c index 9dedc05474..ee7af70dd0 100644 --- a/opal/mca/pmix/base/pmix_base_fns.c +++ b/opal/mca/pmix/base/pmix_base_fns.c @@ -3,7 +3,7 @@ * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science + * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -152,16 +152,14 @@ int opal_pmix_base_exchange(opal_value_t *indat, info->type = OPAL_BOOL; info->data.flag = true; opal_list_append(&mlist, &info->super); - if (0 < timeout) { - /* give it a decent timeout as we don't know when - * the other side will publish - it doesn't - * have to be simultaneous */ - info = OBJ_NEW(opal_value_t); - info->key = strdup(OPAL_PMIX_TIMEOUT); - info->type = OPAL_INT; - info->data.integer = timeout; - opal_list_append(&mlist, &info->super); - } + /* give it a decent timeout as we don't know when + * the other side will publish - it doesn't + * have to be simultaneous */ + info = OBJ_NEW(opal_value_t); + info->key = strdup(OPAL_PMIX_TIMEOUT); + info->type = OPAL_INT; + info->data.integer = timeout; + opal_list_append(&mlist, &info->super); /* if a non-blocking version of lookup isn't * available, then use the blocking version */ diff --git a/opal/mca/pmix/pmix112/pmix1_client.c b/opal/mca/pmix/pmix112/pmix1_client.c index 9bdfed394e..ff58db80e6 100644 --- a/opal/mca/pmix/pmix112/pmix1_client.c +++ b/opal/mca/pmix/pmix112/pmix1_client.c @@ -469,6 +469,7 @@ int pmix1_get(const opal_process_name_t *proc, const char *key, OPAL_LIST_FOREACH(ival, info, opal_value_t) { (void)strncpy(pinfo[n].key, ival->key, PMIX_MAX_KEYLEN); pmix1_value_load(&pinfo[n].value, ival); + ++n; } } else { pinfo = NULL; @@ -562,6 +563,7 @@ int pmix1_getnb(const opal_process_name_t *proc, const char *key, OPAL_LIST_FOREACH(ival, info, opal_value_t) { (void)strncpy(op->info[n].key, ival->key, PMIX_MAX_KEYLEN); pmix1_value_load(&op->info[n].value, ival); + ++n; } } } @@ -673,7 +675,7 @@ int pmix1_lookup(opal_list_t *data, opal_list_t *info) PMIX_INFO_CREATE(pinfo, ninfo); n=0; OPAL_LIST_FOREACH(iptr, info, opal_value_t) { - (void)strncpy(pinfo[n++].key, iptr->key, PMIX_MAX_KEYLEN); + (void)strncpy(pinfo[n].key, iptr->key, PMIX_MAX_KEYLEN); pmix1_value_load(&pinfo[n].value, iptr); ++n; } @@ -847,7 +849,7 @@ int pmix1_unpublish(char **keys, opal_list_t *info) PMIX_INFO_CREATE(pinfo, ninfo); n=0; OPAL_LIST_FOREACH(iptr, info, opal_value_t) { - (void)strncpy(pinfo[n++].key, iptr->key, PMIX_MAX_KEYLEN); + (void)strncpy(pinfo[n].key, iptr->key, PMIX_MAX_KEYLEN); pmix1_value_load(&pinfo[n].value, iptr); ++n; } diff --git a/orte/orted/pmix/pmix_server.c b/orte/orted/pmix/pmix_server.c index 780286e3c0..af633b7774 100644 --- a/orte/orted/pmix/pmix_server.c +++ b/orte/orted/pmix/pmix_server.c @@ -16,7 +16,7 @@ * Copyright (c) 2013-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science + * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -150,11 +150,17 @@ static void eviction_cbfunc(struct opal_hotel_t *hotel, int room_num, void *occupant) { pmix_server_req_t *req = (pmix_server_req_t*)occupant; + bool timeout = false; int rc; /* decrement the request timeout */ - req->timeout -= orte_pmix_server_globals.timeout; - if (0 < req->timeout) { + if (req->timeout > 0) { + req->timeout -= orte_pmix_server_globals.timeout; + if (0 >= req->timeout) { + timeout = true; + } + } + if (!timeout) { /* not done yet - check us back in */ if (OPAL_SUCCESS == (rc = opal_hotel_checkin(&orte_pmix_server_globals.reqs, req, &req->room_num))) { return; diff --git a/orte/orted/pmix/pmix_server_pub.c b/orte/orted/pmix/pmix_server_pub.c index 498760e22e..75617f1e5e 100644 --- a/orte/orted/pmix/pmix_server_pub.c +++ b/orte/orted/pmix/pmix_server_pub.c @@ -16,7 +16,7 @@ * Copyright (c) 2013-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -156,13 +156,17 @@ int pmix_server_publish_fn(opal_process_name_t *proc, return rc; } - /* if we have items, pack those too - ignore persistence + /* if we have items, pack those too - ignore persistence, timeout * and range values */ OPAL_LIST_FOREACH(iptr, info, opal_value_t) { if (0 == strcmp(iptr->key, OPAL_PMIX_RANGE) || 0 == strcmp(iptr->key, OPAL_PMIX_PERSISTENCE)) { continue; } + if (0 == strcmp(iptr->key, OPAL_PMIX_TIMEOUT)) { + req->timeout = iptr->data.integer; + continue; + } opal_output_verbose(5, orte_pmix_server_globals.output, "%s publishing data %s of type %d from source %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), iptr->key, iptr->type, @@ -250,11 +254,15 @@ int pmix_server_lookup_fn(opal_process_name_t *proc, char **keys, } } - /* if we have items, pack those too - ignore range value */ + /* if we have items, pack those too - ignore range and timeout values */ OPAL_LIST_FOREACH(iptr, info, opal_value_t) { if (0 == strcmp(iptr->key, OPAL_PMIX_RANGE)) { continue; } + if (0 == strcmp(iptr->key, OPAL_PMIX_TIMEOUT)) { + req->timeout = iptr->data.integer; + continue; + } if (OPAL_SUCCESS != (rc = opal_dss.pack(&req->msg, &iptr, 1, OPAL_VALUE))) { ORTE_ERROR_LOG(rc); OBJ_RELEASE(req); @@ -340,11 +348,15 @@ int pmix_server_unpublish_fn(opal_process_name_t *proc, char **keys, } } - /* if we have items, pack those too - ignore range value */ + /* if we have items, pack those too - ignore range and timeout values */ OPAL_LIST_FOREACH(iptr, info, opal_value_t) { if (0 == strcmp(iptr->key, OPAL_PMIX_RANGE)) { continue; } + if (0 == strcmp(iptr->key, OPAL_PMIX_TIMEOUT)) { + req->timeout = iptr->data.integer; + continue; + } if (OPAL_SUCCESS != (rc = opal_dss.pack(&req->msg, &iptr, 1, OPAL_VALUE))) { ORTE_ERROR_LOG(rc); OBJ_RELEASE(req);