Skip to content

Commit 086ffc1

Browse files
committed
pml/ob1: fix race on pml completion of send requests
The request code was setting the request as pml_complete before calling MCA_PML_OB1_SEND_REQUEST_MPI_COMPLETE. This was causing MCA_PML_OB1_SEND_REQUEST_RETURN to be called twice in some cases. The code now mirrors the recvreq code and only sets the request as pml complete if the request has not already been freed. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 2c3d522 commit 086ffc1

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

ompi/mca/pml/ob1/pml_ob1_sendreq.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,18 @@ send_request_pml_complete(mca_pml_ob1_send_request_t *sendreq)
262262
mca_pml_base_bsend_request_fini((ompi_request_t*)sendreq);
263263
}
264264

265-
sendreq->req_send.req_base.req_pml_complete = true;
265+
if (!sendreq->req_send.req_base.req_free_called) {
266+
sendreq->req_send.req_base.req_pml_complete = true;
266267

267-
if( !REQUEST_COMPLETE( &((sendreq->req_send).req_base.req_ompi)) ) {
268-
/* Should only be called for long messages (maybe synchronous) */
269-
MCA_PML_OB1_SEND_REQUEST_MPI_COMPLETE(sendreq, true);
270-
} else {
271-
if( MPI_SUCCESS != sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR ) {
272-
ompi_mpi_abort(&ompi_mpi_comm_world.comm, MPI_ERR_REQUEST);
268+
if( !REQUEST_COMPLETE( &((sendreq->req_send).req_base.req_ompi)) ) {
269+
/* Should only be called for long messages (maybe synchronous) */
270+
MCA_PML_OB1_SEND_REQUEST_MPI_COMPLETE(sendreq, true);
271+
} else {
272+
if( MPI_SUCCESS != sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR ) {
273+
ompi_mpi_abort(&ompi_mpi_comm_world.comm, MPI_ERR_REQUEST);
274+
}
273275
}
274-
}
275-
if(true == sendreq->req_send.req_base.req_free_called) {
276+
} else {
276277
MCA_PML_OB1_SEND_REQUEST_RETURN(sendreq);
277278
}
278279
}

0 commit comments

Comments
 (0)