Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit 670858a

Browse files
authored
Merge pull request #1284 from ggouaillardet/topic/v2.x/pmix_typos_and_timeout
v2.x: fix pmix typos and timeout
2 parents d29331e + b440a37 commit 670858a

File tree

4 files changed

+38
-20
lines changed

4 files changed

+38
-20
lines changed

opal/mca/pmix/base/pmix_base_fns.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
44
* reserved.
55
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
6-
* Copyright (c) 2014-2015 Research Organization for Information Science
6+
* Copyright (c) 2014-2016 Research Organization for Information Science
77
* and Technology (RIST). All rights reserved.
88
* $COPYRIGHT$
99
*
@@ -152,16 +152,14 @@ int opal_pmix_base_exchange(opal_value_t *indat,
152152
info->type = OPAL_BOOL;
153153
info->data.flag = true;
154154
opal_list_append(&mlist, &info->super);
155-
if (0 < timeout) {
156-
/* give it a decent timeout as we don't know when
157-
* the other side will publish - it doesn't
158-
* have to be simultaneous */
159-
info = OBJ_NEW(opal_value_t);
160-
info->key = strdup(OPAL_PMIX_TIMEOUT);
161-
info->type = OPAL_INT;
162-
info->data.integer = timeout;
163-
opal_list_append(&mlist, &info->super);
164-
}
155+
/* give it a decent timeout as we don't know when
156+
* the other side will publish - it doesn't
157+
* have to be simultaneous */
158+
info = OBJ_NEW(opal_value_t);
159+
info->key = strdup(OPAL_PMIX_TIMEOUT);
160+
info->type = OPAL_INT;
161+
info->data.integer = timeout;
162+
opal_list_append(&mlist, &info->super);
165163

166164
/* if a non-blocking version of lookup isn't
167165
* available, then use the blocking version */

opal/mca/pmix/pmix112/pmix1_client.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
469469
OPAL_LIST_FOREACH(ival, info, opal_value_t) {
470470
(void)strncpy(pinfo[n].key, ival->key, PMIX_MAX_KEYLEN);
471471
pmix1_value_load(&pinfo[n].value, ival);
472+
++n;
472473
}
473474
} else {
474475
pinfo = NULL;
@@ -562,6 +563,7 @@ int pmix1_getnb(const opal_process_name_t *proc, const char *key,
562563
OPAL_LIST_FOREACH(ival, info, opal_value_t) {
563564
(void)strncpy(op->info[n].key, ival->key, PMIX_MAX_KEYLEN);
564565
pmix1_value_load(&op->info[n].value, ival);
566+
++n;
565567
}
566568
}
567569
}
@@ -673,7 +675,7 @@ int pmix1_lookup(opal_list_t *data, opal_list_t *info)
673675
PMIX_INFO_CREATE(pinfo, ninfo);
674676
n=0;
675677
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
676-
(void)strncpy(pinfo[n++].key, iptr->key, PMIX_MAX_KEYLEN);
678+
(void)strncpy(pinfo[n].key, iptr->key, PMIX_MAX_KEYLEN);
677679
pmix1_value_load(&pinfo[n].value, iptr);
678680
++n;
679681
}
@@ -847,7 +849,7 @@ int pmix1_unpublish(char **keys, opal_list_t *info)
847849
PMIX_INFO_CREATE(pinfo, ninfo);
848850
n=0;
849851
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
850-
(void)strncpy(pinfo[n++].key, iptr->key, PMIX_MAX_KEYLEN);
852+
(void)strncpy(pinfo[n].key, iptr->key, PMIX_MAX_KEYLEN);
851853
pmix1_value_load(&pinfo[n].value, iptr);
852854
++n;
853855
}

orte/orted/pmix/pmix_server.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
1717
* Copyright (c) 2014 Mellanox Technologies, Inc.
1818
* All rights reserved.
19-
* Copyright (c) 2014-2015 Research Organization for Information Science
19+
* Copyright (c) 2014-2016 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
2121
* $COPYRIGHT$
2222
*
@@ -150,11 +150,17 @@ static void eviction_cbfunc(struct opal_hotel_t *hotel,
150150
int room_num, void *occupant)
151151
{
152152
pmix_server_req_t *req = (pmix_server_req_t*)occupant;
153+
bool timeout = false;
153154
int rc;
154155

155156
/* decrement the request timeout */
156-
req->timeout -= orte_pmix_server_globals.timeout;
157-
if (0 < req->timeout) {
157+
if (req->timeout > 0) {
158+
req->timeout -= orte_pmix_server_globals.timeout;
159+
if (0 >= req->timeout) {
160+
timeout = true;
161+
}
162+
}
163+
if (!timeout) {
158164
/* not done yet - check us back in */
159165
if (OPAL_SUCCESS == (rc = opal_hotel_checkin(&orte_pmix_server_globals.reqs, req, &req->room_num))) {
160166
return;

orte/orted/pmix/pmix_server_pub.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
1717
* Copyright (c) 2014 Mellanox Technologies, Inc.
1818
* All rights reserved.
19-
* Copyright (c) 2014 Research Organization for Information Science
19+
* Copyright (c) 2014-2016 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
2121
* $COPYRIGHT$
2222
*
@@ -156,13 +156,17 @@ int pmix_server_publish_fn(opal_process_name_t *proc,
156156
return rc;
157157
}
158158

159-
/* if we have items, pack those too - ignore persistence
159+
/* if we have items, pack those too - ignore persistence, timeout
160160
* and range values */
161161
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
162162
if (0 == strcmp(iptr->key, OPAL_PMIX_RANGE) ||
163163
0 == strcmp(iptr->key, OPAL_PMIX_PERSISTENCE)) {
164164
continue;
165165
}
166+
if (0 == strcmp(iptr->key, OPAL_PMIX_TIMEOUT)) {
167+
req->timeout = iptr->data.integer;
168+
continue;
169+
}
166170
opal_output_verbose(5, orte_pmix_server_globals.output,
167171
"%s publishing data %s of type %d from source %s",
168172
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,
250254
}
251255
}
252256

253-
/* if we have items, pack those too - ignore range value */
257+
/* if we have items, pack those too - ignore range and timeout values */
254258
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
255259
if (0 == strcmp(iptr->key, OPAL_PMIX_RANGE)) {
256260
continue;
257261
}
262+
if (0 == strcmp(iptr->key, OPAL_PMIX_TIMEOUT)) {
263+
req->timeout = iptr->data.integer;
264+
continue;
265+
}
258266
if (OPAL_SUCCESS != (rc = opal_dss.pack(&req->msg, &iptr, 1, OPAL_VALUE))) {
259267
ORTE_ERROR_LOG(rc);
260268
OBJ_RELEASE(req);
@@ -340,11 +348,15 @@ int pmix_server_unpublish_fn(opal_process_name_t *proc, char **keys,
340348
}
341349
}
342350

343-
/* if we have items, pack those too - ignore range value */
351+
/* if we have items, pack those too - ignore range and timeout values */
344352
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
345353
if (0 == strcmp(iptr->key, OPAL_PMIX_RANGE)) {
346354
continue;
347355
}
356+
if (0 == strcmp(iptr->key, OPAL_PMIX_TIMEOUT)) {
357+
req->timeout = iptr->data.integer;
358+
continue;
359+
}
348360
if (OPAL_SUCCESS != (rc = opal_dss.pack(&req->msg, &iptr, 1, OPAL_VALUE))) {
349361
ORTE_ERROR_LOG(rc);
350362
OBJ_RELEASE(req);

0 commit comments

Comments
 (0)