Skip to content

Commit

Permalink
DAOS-16340 cart: Fix order of finalize in cart_ctl (#14969) (#14976)
Browse files Browse the repository at this point in the history
- Fix finalization order in the cart_ctl tool, where now
a group is destroyed only after the progress has been stopped.

This avoids a segfault that can happen if an RPC is cancelled
as part of the 'progress stop' sequence, which then references
a group.

Signed-off-by: Alexander A Oganezov <alexander.a.oganezov@intel.com>
  • Loading branch information
frostedcmos authored Aug 22, 2024
1 parent 2145093 commit 7a5a186
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/utils/ctl/cart_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,13 @@ ctl_init()
rc);
}

/* Stop the progress thread before destroying the group */
crtu_progress_stop();

rc = pthread_join(ctl_gdata.cg_tid, NULL);
if (rc != 0)
error_warn("Failed to join the threads; rc=%d\n", rc);

d_rank_list_free(rank_list);

if (ctl_gdata.cg_save_cfg) {
Expand All @@ -772,12 +779,6 @@ ctl_init()
error_warn("Failed to destroy the view; rc=%d\n", rc);
}

crtu_progress_stop();

rc = pthread_join(ctl_gdata.cg_tid, NULL);
if (rc != 0)
error_warn("Failed to join the threads; rc=%d\n", rc);

rc = sem_destroy(&ctl_gdata.cg_num_reply);
if (rc != 0)
error_warn("Failed to destroy a semaphore; rc=%d\n", rc);
Expand Down

0 comments on commit 7a5a186

Please sign in to comment.