Skip to content

Commit

Permalink
maintain correct ref count of child jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Domink Huber committed Dec 5, 2024
1 parent b7196af commit c1b345d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/mca/state/dvm/state_dvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,8 @@ static void check_complete(int fd, short args, void *cbdata)

static void cleanup_job(int sd, short args, void *cbdata)
{
pmix_proc_t *nptr;
prte_job_t *parent;
prte_state_caddy_t *caddy = (prte_state_caddy_t *) cbdata;
PRTE_HIDE_UNUSED_PARAMS(sd, args);

Expand All @@ -876,6 +878,16 @@ static void cleanup_job(int sd, short args, void *cbdata)
prte_plm.terminate_orteds();
}
if (NULL != caddy->jdata) {
/* if the job had a spawn parent remove it from the parents child list */
if (prte_get_attribute(&caddy->jdata->attributes, PRTE_JOB_LAUNCH_PROXY, (void **) &nptr, PMIX_PROC)) {
if(NULL != (parent = prte_get_job_data_object(nptr->nspace)) &&
!PMIX_CHECK_NSPACE(parent->nspace, PRTE_PROC_MY_NAME->nspace)){
pmix_list_remove_item(&parent->children, &caddy->jdata->super)
/* We retained the jdata before adding it to the list - maintain ref count */
PMIX_RELEASE(caddy->jdata);
}
PMIX_PROC_RELEASE(nptr);
}
PMIX_RELEASE(caddy->jdata);
}
PMIX_RELEASE(caddy);
Expand Down
7 changes: 1 addition & 6 deletions src/runtime/prte_globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,12 +708,7 @@ static void prte_job_destruct(prte_job_t *job)

PMIX_DATA_BUFFER_DESTRUCT(&job->launch_msg);

/* Clear the child list before destroying the list */
PMIX_LIST_FOREACH(child_jdata, &job->children, prte_job_t)
{
pmix_list_remove_item(&job->children, &child_jdata->super);
}

/* Release the child list - we retained the child jobs before adding them to the list*/
PMIX_LIST_DESTRUCT(&job->children);

if (NULL != job->session_dir) {
Expand Down

0 comments on commit c1b345d

Please sign in to comment.