@@ -111,7 +111,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
111111 PMIX_RELEASE (cb );
112112
113113 pmix_output_verbose (2 , pmix_globals .debug_output ,
114- "pmix:client get completed" );
114+ "pmix:client get completed %d" , rc );
115115
116116 return rc ;
117117}
@@ -464,7 +464,7 @@ static pmix_status_t process_val(pmix_value_t *val,
464464 }
465465 nvals = 0 ;
466466 for (n = 0 ; n < nsize ; n ++ ) {
467- if (PMIX_SUCCESS != (rc = pmix_pointer_array_add (results , & info [n ]))) {
467+ if (0 > (rc = pmix_pointer_array_add (results , & info [n ]))) {
468468 return rc ;
469469 }
470470 ++ nvals ;
@@ -536,25 +536,45 @@ static void _getnbfn(int fd, short flags, void *cbdata)
536536 /* if the rank is WILDCARD, then they want all the job-level info,
537537 * so no need to check the modex */
538538 if (PMIX_RANK_WILDCARD != cb -> rank ) {
539+ rc = PMIX_ERR_NOT_FOUND ;
539540#if defined(PMIX_ENABLE_DSTORE ) && (PMIX_ENABLE_DSTORE == 1 )
540- if (PMIX_SUCCESS == (rc = pmix_dstore_fetch (nptr -> nspace , cb -> rank , NULL , & val ))) {
541- #else
542- if (PMIX_SUCCESS == (rc = pmix_hash_fetch (& nptr -> modex , cb -> rank , NULL , & val ))) {
541+ /* my own data is in the hash table, so don't bother looking
542+ * in the dstore if that is what they want */
543+ if (pmix_globals .myid .rank != cb -> rank ) {
544+ if (PMIX_SUCCESS == (rc = pmix_dstore_fetch (nptr -> nspace , cb -> rank , NULL , & val ))) {
545+ pmix_output_verbose (2 , pmix_globals .debug_output ,
546+ "pmix_get[%d]: value retrieved from dstore" , __LINE__ );
547+ if (PMIX_SUCCESS != (rc = process_val (val , & nvals , & results ))) {
548+ cb -> value_cbfunc (rc , NULL , cb -> cbdata );
549+ /* cleanup */
550+ if (NULL != val ) {
551+ PMIX_VALUE_RELEASE (val );
552+ }
553+ PMIX_RELEASE (cb );
554+ return ;
555+ }
556+ }
557+ }
543558#endif /* PMIX_ENABLE_DSTORE */
544- pmix_output_verbose (2 , pmix_globals .debug_output ,
545- "pmix_get[%d]: value retrieved from dstore" , __LINE__ );
546- if (PMIX_SUCCESS != (rc = process_val (val , & nvals , & results ))) {
547- cb -> value_cbfunc (rc , NULL , cb -> cbdata );
548- /* cleanup */
549- if (NULL != val ) {
550- PMIX_VALUE_RELEASE (val );
559+ if (PMIX_SUCCESS != rc ) {
560+ /* if the user was asking about themselves, or we aren't using the dstore,
561+ * then we need to check the hash table */
562+ if (PMIX_SUCCESS == (rc = pmix_hash_fetch (& nptr -> modex , cb -> rank , NULL , & val ))) {
563+ pmix_output_verbose (2 , pmix_globals .debug_output ,
564+ "pmix_get[%d]: value retrieved from hash" , __LINE__ );
565+ if (PMIX_SUCCESS != (rc = process_val (val , & nvals , & results ))) {
566+ cb -> value_cbfunc (rc , NULL , cb -> cbdata );
567+ /* cleanup */
568+ if (NULL != val ) {
569+ PMIX_VALUE_RELEASE (val );
570+ }
571+ PMIX_RELEASE (cb );
572+ return ;
551573 }
552- PMIX_RELEASE (cb );
553- return ;
574+ PMIX_VALUE_RELEASE (val );
554575 }
555- /* cleanup */
556- PMIX_VALUE_RELEASE (val );
557- } else {
576+ }
577+ if (PMIX_SUCCESS != rc ) {
558578 /* if we didn't find a modex for this rank, then we need
559579 * to go get it. Thus, the caller wants -all- information for
560580 * the specified rank, not just the job-level info. */
@@ -572,12 +592,17 @@ static void _getnbfn(int fd, short flags, void *cbdata)
572592 PMIX_RELEASE (cb );
573593 return ;
574594 }
575- /* cleanup */
576595 PMIX_VALUE_RELEASE (val );
577596 }
578597 /* now let's package up the results */
579598 PMIX_VALUE_CREATE (val , 1 );
580599 val -> type = PMIX_DATA_ARRAY ;
600+ val -> data .darray = (pmix_data_array_t * )malloc (sizeof (pmix_data_array_t ));
601+ if (NULL == val -> data .darray ) {
602+ PMIX_VALUE_RELEASE (val );
603+ cb -> value_cbfunc (PMIX_ERR_NOMEM , NULL , cb -> cbdata );
604+ return ;
605+ }
581606 val -> data .darray -> type = PMIX_INFO ;
582607 val -> data .darray -> size = nvals ;
583608 PMIX_INFO_CREATE (iptr , nvals );
@@ -597,14 +622,13 @@ static void _getnbfn(int fd, short flags, void *cbdata)
597622 } else {
598623 pmix_value_xfer (& iptr [n ].value , & info -> value );
599624 }
600- PMIX_INFO_FREE (info , 1 );
625+ PMIX_INFO_DESTRUCT (info );
601626 }
602627 }
603628 /* done with results array */
604629 PMIX_DESTRUCT (& results );
605- /* return the result to the caller */
630+ /* return the result to the caller - they are responsible for releasing it */
606631 cb -> value_cbfunc (PMIX_SUCCESS , val , cb -> cbdata );
607- PMIX_VALUE_FREE (val , 1 );
608632 PMIX_RELEASE (cb );
609633 return ;
610634 }
0 commit comments