Replication #ZN8: Received bytes and received data logs mismatch

I can see that the replica has received 1 out of the three 3 set commands sent to the master, but am unable to do anything about it because the Received bytes field is not giving me any information to further pinpoint the issue. Pushing my code to the repository itself.

Is this because the connection closes because it expects my code to run faster? Or can this be something else?

I also see that the received bytes data does not match with the log data in the next line.

Hey @BhardwajShrey,

I can confirm that there’s an error in how we log the Received bytes: "" line when the response contains null bytes. That line is supposed to include the \x00… characters. @ryan-gang should have a fix for this out soon.

We were able to track the null bytes error down to this line:

Since the entire buffer is being used here, the remaining bytes may contain null values from when the buffer was initialized.

One way to fix this would be to do something like:

var reqString = Encoding.UTF8.GetString(buffer, 0, dataSizeInBytes);

Hope this helps! I’ll keep this open until we have the logging fix out

1 Like

I can confirm that this issue goes away when I use dataSizeInBytes to specify the size of the string to GetString(). I think I’ll adopt this practice in my regular programming as well. Thank you.

1 Like

Note: I’ve updated the title of this post to include the stage ID (#ZN8). You can learn about the stages rename here: Upcoming change: Stages overhaul