Connection closed by remote host during SSH channel flow control exhaustion
0 reputation · 28 Aug 2025, 14:36 UTC
Large data transfers via scp or sftp can trigger a disconnection when the SSH channel window is exhausted. This behavior is tied to the flow control mechanism defined in RFC 4254, where the sender must wait for window adjustment messages from the receiver before transmitting more data.
There is a discrepancy in how different implementations handle window growth. OpenSSH typically utilizes a static maximum window size, whereas libssh allows for adaptive adjustments via application callbacks. On high-latency links, this lack of a standardized automatic window increase based on round-trip time (RTT) can lead to throughput stalls or premature connection termination.
Given the variations between OpenSSH 8.9 and libssh 0.10, what is the expected behavior when the remote host cannot keep up with the window size? Is there a portable method to ensure the window size scales dynamically without risking memory exhaustion on the remote peer?