Skip to content

Commit c70732c

Browse files
Prevent subcomms from being freed before user's comm
Signed-off-by: Matthew Whitlock <mwhitlo@sandia.gov>
1 parent e2a2583 commit c70732c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ompi/mca/coll/han/coll_han_subcomms.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,17 @@ int mca_coll_han_comm_create_new(struct ompi_communicator_t *comm,
206206
HAN_SUBCOM_RESTORE_COLLECTIVE(fallbacks, comm, han_module, scatterv);
207207

208208
OBJ_DESTRUCT(&comm_info);
209+
210+
/* Ensure these communicators aren't released before the parent comm */
211+
if(!OMPI_COMM_IS_EXTRA_RETAIN(*low_comm)){
212+
OMPI_COMM_SET_EXTRA_RETAIN(*low_comm);
213+
OBJ_RETAIN(*low_comm);
214+
}
215+
if(!OMPI_COMM_IS_EXTRA_RETAIN(*up_comm)){
216+
OMPI_COMM_SET_EXTRA_RETAIN(*up_comm);
217+
OBJ_RETAIN(*up_comm);
218+
}
219+
209220
return OMPI_SUCCESS;
210221

211222
return_with_error:

0 commit comments

Comments
 (0)