Commit b6247662 authored by Guillaume Mercier's avatar Guillaume Mercier
Browse files

[svn-r7380] The endpoint info (vc ptr) is not always set after the connect sequence

and the unexpected callback might be called and set a NULL vc ptr to the ADI request.
This test fixes this case. Ideally, connecting to the remote endpoint and attaching
the vc ptr info should be atomic.
parent c3582c33
......@@ -328,8 +328,10 @@ MPID_nem_mx_poll(int in_blocking_poll)
}
else if (kind == MPID_REQUEST_RECV)
{
MPID_nem_mx_internal_req_t *adi_req = &(myreq->nem_mx_req);
MPID_nem_mx_internal_req_t *adi_req = &(myreq->nem_mx_req);
MPIU_Assert(status.code != MX_STATUS_TRUNCATED);
if(adi_req->vc == NULL)
mx_get_endpoint_addr_context(status.source,(void **)(&(adi_req->vc)));
if (status.msg_length <= sizeof(MPIDI_CH3_PktGeneric_t))
{
MPID_nem_handle_pkt(adi_req->vc,(char *)&(adi_req->pending_pkt),(MPIDI_msg_sz_t)(status.msg_length));
......@@ -432,6 +434,8 @@ MPID_nem_mx_poll(int in_blocking_progress)
{
MPID_nem_mx_internal_req_t *adi_req = &(myreq->nem_mx_req);
MPIU_Assert(status.code != MX_STATUS_TRUNCATED);
if(adi_req->vc == NULL)
mx_get_endpoint_addr_context(status.source,(void **)(&(adi_req->vc)));
if (status.msg_length <= sizeof(MPIDI_CH3_PktGeneric_t))
{
MPID_nem_handle_pkt(adi_req->vc,(char *)&(adi_req->pending_pkt),(MPIDI_msg_sz_t)(status.msg_length));
......@@ -552,8 +556,23 @@ MPID_nem_mx_handle_rreq(MPID_Request *req, mx_status_t status)
MPIDI_Datatype_get_info(req->dev.user_count, req->dev.datatype, dt_contig, userbuf_sz, dt_ptr, dt_true_lb);
/*fprintf(stdout," ===> userbuf_size is %i, msg_length is %i, xfer_length is %i\n",userbuf_sz,status.msg_length,status.xfer_length); */
if (status.msg_length <= userbuf_sz) {
data_sz = req->dev.recv_data_sz;
if (status.msg_length <= userbuf_sz)
{
data_sz = status.xfer_length;
/* the sent message was truncated */
if (status.msg_length != status.xfer_length )
{
MPIU_DBG_MSG_FMT(CH3_OTHER,VERBOSE,(MPIU_DBG_FDEST,
"message truncated on receiver side, real_msg_sz="
MPIDI_MSG_SZ_FMT ", expected_msg_sz="
MPIDI_MSG_SZ_FMT,
status.xfer_length, status.msg_length));
req->status.MPI_ERROR = MPIR_Err_create_code(MPI_SUCCESS,
MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_TRUNCATE,
"**truncate", "**truncate %d %d %d %d",
req->status.MPI_SOURCE, req->status.MPI_TAG,
req->dev.recv_data_sz, userbuf_sz );
}
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment