I am seeing unexpected results from RDMA reads that make me doubt my understanding of the RDMA read and write semantics.
I'm trying to implement message passing in RMDA in a manner similar to L5, but am running into issues that look like memory tearing. But that shouldn't be happening.
I have a struct that is a bit more complicated than what L5 has:
struct Header {
std::atomic<uint8_t> mailbox = 1;
std::atomic<uint32_t> length;
char data[128];
};
On the writing side, I do RDMA reads until I see a value of 1 in mailbox. Then I do an RDMA write of length + data, set mailbox to 0, and send mailbox with a second RDMA write. On the reading side, I check for mailbox == 0, read the data, and set length to 0 and mailbox to 1.
When I do my RDMA reads I am occasionally seeing lengths <> 0 along with mailbox values of 0. Since RDMA operations are supposed to happen in order, I do not understand how this is happening.