• yoav-steinberg's avatar
    Make sure replicas don't write their own replies to the replication link (#10020) · 2ff3fc17
    yoav-steinberg authored
    Since #9166 we have an assertion here to make sure replica clients don't write anything to their buffer.
    But in reality a replica may attempt write data to it's buffer simply by sending a command on the replication link.
    This command in most cases will be rejected since #8868 but it'll still generate an error.
    Actually the only valid command to send on a replication link is 'REPCONF ACK` which generates no response.
    
    We want to keep the design so that replicas can send commands but we need to avoid any situation where we start
    putting data in their response buffers, especially since they aren't used anymore. This PR makes sure to disconnect
    a rogue client which generated a write on the replication link that cause something to be written to the response buffer.
    
    To recreate the bug this fixes simply connect via telnet to a redis server and write sync\r\n wait for the the payload to
    be written and then write any command (valid or invalid), such as ping\r\n on the telnet connection. It'll crash the server.
    2ff3fc17
networking.c 157 KB