Summary
protocol.cpp:322 redis_protocol::write_command_readonly() passes 16 to evbuffer_add for the literal *1\r\n$8\r\nREADONLY\r\n which is 18 bytes. Truncates trailing \r\n — server would hang waiting for command terminator.
Why not currently triggered
The READONLY setup-ladder in shard_connection.cpp:923-924 uses a raw bufferevent_write(...) with sizeof(READONLY_CMD)-1 (correct 18-byte length). The vtable method is unused. grep of the tree returns no other callers.
Why fix it anyway
If anyone later refactors the ladder or rearm_readonly to use the vtable method for uniformity with AUTH/SELECT/HELLO/CLUSTER_SLOTS, the bug surfaces silently as a server hang.
Suggested fix
Change the 16 to sizeof("*1\r\n$8\r\nREADONLY\r\n")-1 (= 18), or just delete the dead method since the actual call site bypasses it.
Surfaced during PR #456 round-16 deep review (R1 opus).
Summary
protocol.cpp:322redis_protocol::write_command_readonly()passes16toevbuffer_addfor the literal*1\r\n$8\r\nREADONLY\r\nwhich is 18 bytes. Truncates trailing\r\n— server would hang waiting for command terminator.Why not currently triggered
The READONLY setup-ladder in
shard_connection.cpp:923-924uses a rawbufferevent_write(...)withsizeof(READONLY_CMD)-1(correct 18-byte length). The vtable method is unused.grepof the tree returns no other callers.Why fix it anyway
If anyone later refactors the ladder or
rearm_readonlyto use the vtable method for uniformity with AUTH/SELECT/HELLO/CLUSTER_SLOTS, the bug surfaces silently as a server hang.Suggested fix
Change the
16tosizeof("*1\r\n$8\r\nREADONLY\r\n")-1(= 18), or just delete the dead method since the actual call site bypasses it.Surfaced during PR #456 round-16 deep review (R1 opus).