Skip to content

Commit

Permalink
fix callback's access to stale ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeseungYeom committed Feb 14, 2024
1 parent 2adaded commit c4cd6d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/dyad/dtl/ucx_dtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,16 @@ static void dyad_recv_callback (void* request, ucs_status_t status, ucp_tag_recv

#if UCP_API_VERSION >= UCP_VERSION(1, 10)
static void dyad_send_callback (void* req, ucs_status_t status, void* ctx)
{
DYAD_C_FUNCTION_START();
DYAD_LOG_INFO ((dyad_ctx_t*) ctx, "Calling send callback");
dyad_ucx_request_t* real_req = (dyad_ucx_request_t*)req;
real_req->completed = 1;
DYAD_C_FUNCTION_END();
}
#else // UCP_API_VERSION
static void dyad_send_callback (void* req, ucs_status_t status)
#endif // UCP_API_VERSION
{
DYAD_C_FUNCTION_START();
DYAD_LOG_STDOUT ("Calling send callback");
DYAD_LOG_STDERR ("Calling send callback");
dyad_ucx_request_t* real_req = (dyad_ucx_request_t*)req;
real_req->completed = 1;
DYAD_C_FUNCTION_END();
}
#endif // UCP_API_VERSION

// Simple function used to wait on the async receive
static ucs_status_t dyad_ucx_request_wait (const dyad_ctx_t* ctx,
Expand Down
2 changes: 1 addition & 1 deletion src/dyad/dtl/ucx_ep_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ dyad_rc_t dyad_ucx_ep_cache_init (const dyad_ctx_t *ctx, ucx_ep_cache_h* cache)
rc = DYAD_RC_BADBUF;
goto ucx_ep_cache_init_done;
}
*cache = reinterpret_cast<ucx_ep_cache_h> (new (std::nothrow) cache_type ());
*cache = static_cast<ucx_ep_cache_h> (new (std::nothrow) cache_type ());
if (*cache == nullptr) {
rc = DYAD_RC_SYSFAIL;
goto ucx_ep_cache_init_done;
Expand Down

0 comments on commit c4cd6d5

Please sign in to comment.