Skip to content

Commit

Permalink
added proper cleanup code for pending probe operation
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorier committed Jun 24, 2022
1 parent 01ab0fd commit 4f71d98
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/mona.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,18 @@ mona_instance_t mona_init_na_pool(na_class_t* na_class,

na_return_t mona_finalize(mona_instance_t mona)
{
if(mona->unexpected.prob_active) {
na_return_t na_ret = NA_Cancel(
mona->na_class, mona->na_context, mona->unexpected.prob_id->op_id);
if(na_ret != NA_SUCCESS) {
fprintf(stderr, "WARNING: MoNA could not cancel probe operation\n");
} else {
mona_wait(mona->unexpected.prob_req);
return_op_id_to_cache(mona, mona->unexpected.prob_id);
return_msg_to_cache(mona, mona->unexpected.prob_msg, false);
}
}

mona->finalize_flag = true;
ABT_thread_join(mona->progress_thread);

Expand Down
19 changes: 18 additions & 1 deletion tests/test-usend-urecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,26 @@ static MunitResult test_usend_urecv_probe(const MunitParameter params[], void* d
return MUNIT_OK;
}

static MunitResult test_only_probe(const MunitParameter params[], void* data)
{
(void)params;
test_context* context = (test_context*)data;
na_return_t ret;
mona_instance_t mona = context->mona;

int flag = 0;
ret = mona_uiprobe(mona, MONA_ANY_ADDR, MONA_ANY_TAG, &flag,
NULL, NULL, NULL);
munit_assert_int(ret, ==, NA_SUCCESS);
munit_assert_int(flag, ==, 0);

return MUNIT_OK;
}

static MunitTest test_suite_tests[] = {
{ (char*) "/hl", test_usend_urecv, test_context_setup, test_context_tear_down, MUNIT_TEST_OPTION_NONE, NULL },
{ (char*) "/probe", test_usend_urecv_probe, test_context_setup, test_context_tear_down, MUNIT_TEST_OPTION_NONE, NULL },
{ (char*) "/send_recv_probe", test_usend_urecv_probe, test_context_setup, test_context_tear_down, MUNIT_TEST_OPTION_NONE, NULL },
{ (char*) "/only_probe", test_only_probe, test_context_setup, test_context_tear_down, MUNIT_TEST_OPTION_NONE, NULL },
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
};

Expand Down

0 comments on commit 4f71d98

Please sign in to comment.