Getting 'Received: "" (no content received)' in XV6

Hey folks,

I am getting ‘Received: “” (no content received)’ when master sends GETACK for the first time after the handshake: master: > REPLCONF GETACK *.

I think the problem is the master is sending the command too fast and when the replica is not yet ready to handle the connection.

Here is my code where the handshake starts: codecrafters-redis-rust/src/main.rs at master · rahmonov/codecrafters-redis-rust · GitHub

If I am right about the reason, either the test should wait a bit or I need to do something with the code (I don’t know yet what). I am guessing it is probably the latter haha.

Are we supposed to buffer the incoming commands even before the replica is ready to serve them?

Thank you and I look forward to hearing from you. I have been stuck for a couple of days now.

I’ll take a look and get back to you by the middle of next week.

Thanks! Looking forward to it.

In the meantime, I might have found out what is causing this. The issue could be that in the handshake I am also getting the REPLCONF command together with the RDB file (I didn’t expect this but I guess TCP is unpredictable). And I am reading it all in the handshake. If this is correct, I should stop at RDB file and don’t read the REPLCONF until I start handling the master connection. If that makes sense.

1 Like

Figured this out. Although I don’t like this, the trick was to process all bytes inside the handshake before starting another thread to handle the master connection. Otherwise it is too late and the master already starts sending requests and getting no response. Here is the commit: Proper handshake. Passes all tests consistently · rahmonov/codecrafters-redis-rust@61b4218 · GitHub

1 Like

@moose-715 Sorry for the delayed response. Glad you’ve found a solution!

Let me know if you encounter other issues!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.