HPNL icon indicating copy to clipboard operation
HPNL copied to clipboard

Content sent via sendBuf/sendBufTo is not correct

Open jiafuzha opened this issue 4 years ago • 3 comments

Take sendBuf as example, the parameter buffer is not put to fi_context2. After sendBuf method return, the pointer may be get released even the buffer pointer was passed to fi_send which is asynchronous. Thus, the content referenced by the buffer pointer may be not the same content when we call sendBuf. It causes incorrect content being sent.

int RdmConnection::sendBuf(const char* buffer, int buffer_size)

jiafuzha avatar Sep 01 '19 02:09 jiafuzha

@tanghaodong25 , please check.

jiafuzha avatar Sep 01 '19 02:09 jiafuzha

yes, I'm thinking if we can use fi_sendmsg with FI_INJECT_COMLETION, which guarantees that the buffers will not be read from again and the application may reclaim them. Do you have any suggestion?

tanghaodong25 avatar Sep 02 '19 01:09 tanghaodong25

@tanghaodong25 , I fixed the issue by referencing it from the chunk which is in-turn referenced by fi_context2. It makes sure buffer not being released after sendBuffer return. Before that, I removed the "const" modifier of buffer. otherwise, I cannot set it to chunk's buffer. see RdmConnection.cc in the branch eventpool_rdm_queue.

jiafuzha avatar Sep 02 '19 01:09 jiafuzha