Apparently, during the handshake, master sends a malformed bulk string containing the RDB file:
[tester::#YG4] [handshake] [master] Received [“PSYNC”, “?”, “-1”]
[tester::#YG4] [handshake] [master] Sent “FULLRESYNC 75cd7bc10c49047e0d163660f3b90625b1af31dc 0”
[tester::#YG4] [handshake] [master] Sent bytes: “+FULLRESYNC 75cd7bc10c49047e0d163660f3b90625b1af31dc 0\r\n”
[tester::#YG4] [handshake] [master] Sending RDB file…
[tester::#YG4] [handshake] [master] Sent bytes: “
$88\r\nREDIS0011\xfa\tredis-ver\x057.2.0\xfa\nredis-bits\xc0@\xfa\x05ctime\xc2m\b\xbce\xfa\bused-mem°\xc4\x10\x00\xfa\baof-base\xc0\x00\xff\xf0n;\xfe\xc0\xffZ\xa2
”
[tester::#YG4] [handshake] [master] Sent RDB file.
[your_program] parsing: “
$88\r\nREDIS0011�\tredis-ver\u{5}7.2.0�\nredis-bits�@�\u{5}ctime�m\u{8}�e�\u{8}used-mem°�\u{10}\0�\u{8}aof-base�\0��n;���Z�
”
[your_program] input $88
[your_program] REDIS0011� redis-ver7.2.0�
[your_program] redis-bits�@�ctime��eused-mem°�aof-base���n;���Z� cannot be parsed to a command
[your_program]
[your_program] thread ‘tokio-runtime-worker’ panicked at src/message_handling/message_handler.rs:246:41:
[your_program] range start index 95 out of range for slice of length 93
[your_program] note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
[tester::#YG4] [propagation] [master] > SET foo 123
[tester::#YG4] [propagation] [master] Sent bytes: “*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n”
[tester::#YG4] [propagation] [master] > SET bar 456
[tester::#YG4] [propagation] [master] Sent bytes: “*3\r\n$3\r\nSET\r\n$3\r\nbar\r\n$3\r\n456\r\n”
[tester::#YG4] write tcp 127.0.0.1:6379->127.0.0.1:56176: write: broken pipe
As can be seen above, the bulk string containing the RDB file doesn’t end with “\r\n” to comply with the RESP data format.