Skip to content

Commit

Permalink
Fix HG finalize errors.
Browse files Browse the repository at this point in the history
A big thanks to Chuck Cranor (@chuck) for all his help.

Problem: Leaking SSG structures that internally used HG resources:
margo_wait_for_finalize called before : ssg_finalize and
ssg_group_destroy.
  • Loading branch information
samuelkgutierrez committed Apr 28, 2018
1 parent 32a9f79 commit c1f46e0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/sdsdkv-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@

#define SDSDKV_SERVER_VERBOSE

static void
finalize_cb(void *cba)
{
ssg_finalize();
ssg_group_destroy(*(ssg_group_id_t *)cba);
}

static void
group_update_cb(
ssg_membership_update_t update,
Expand Down Expand Up @@ -156,6 +163,8 @@ struct sdsdkv_server : public personality {
);
}
#endif
margo_push_finalize_callback(m_mid, finalize_cb, &m_mid);
//
margo_wait_for_finalize(m_mid);
#ifdef SDSDKV_SERVER_VERBOSE
printf(
Expand All @@ -165,11 +174,10 @@ struct sdsdkv_server : public personality {
#endif
return SDSDKV_SUCCESS;
}
//
int
close(void)
{
ssg_group_destroy(m_gid);
ssg_finalize();
//
return SDSDKV_SUCCESS;
}
Expand Down

0 comments on commit c1f46e0

Please sign in to comment.