From 7412e27a6629ad08254afd13b116a894f6faba99 Mon Sep 17 00:00:00 2001 From: Austen Lauria Date: Wed, 23 Feb 2022 15:46:15 -0500 Subject: [PATCH] Fix leak of sm_segment files in /dev/shm. I noticed that there were dozens of 'sm_segment.$HOSTNAME.$UID..' files leftover in /dev/shm. This seems to clean it up - the correct namespace wasn't being added so the cleanup callback was doing nothing. This may also cleanup some other leaks, as opal_pmix_register_cleanup() is used in open_file() in opal/util. Signed-off-by: Austen Lauria --- opal/mca/pmix/base/pmix_base_fns.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/opal/mca/pmix/base/pmix_base_fns.c b/opal/mca/pmix/base/pmix_base_fns.c index eaeee0900f9..af707c2111b 100644 --- a/opal/mca/pmix/base/pmix_base_fns.c +++ b/opal/mca/pmix/base/pmix_base_fns.c @@ -492,8 +492,13 @@ int opal_pmix_register_cleanup(char *path, bool directory, bool ignore, bool job rc = PMIx_Job_control_nb(NULL, 0, pinfo, ninfo, cleanup_cbfunc, (void *) &lk); } else { /* only applies to us */ - (void) snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s", - OPAL_JOBID_PRINT(OPAL_PROC_MY_NAME.jobid)); + pmix_nspace_t nspace; + if(OPAL_SUCCESS == opal_pmix_convert_jobid(nspace, OPAL_PROC_MY_NAME.jobid)) { + (void) snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s", nspace); + } + else { + (void) snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s", OPAL_JOBID_PRINT(OPAL_PROC_MY_NAME.jobid)); + } proc.rank = OPAL_PROC_MY_NAME.vpid; rc = PMIx_Job_control_nb(&proc, 1, pinfo, ninfo, cleanup_cbfunc, (void *) &lk); }