IETF-SSH archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ssh channel window and adjustment



Sombody Somewhere  <koda_e%yahoo.com@localhost> wrote:
> 3. What must a peer do, when it has to send data but
> has no channel window ?

There have been other good answers to your other questions, so I
won't spend time repeating them, but I haven't yet seen anyone say
what I want to say in response to this one.

If you have data to send on a channel but there's no window left on
that channel, then (as other people have said) your only option at
the SSH end is to sit on your buffered data and hope you get a
window adjust at some point in the future. Meanwhile you can still
send on _other_ SSH channels, and open new channels, and keep doing
everything else.

But the really important thing you probably want to do if you don't
have any window on a particular channel is to _stop accepting data_
from wherever your source is. For example, if the channel is a
forwarded port, this would be a good moment to stop reading data
from the relevant local network connection. That way, delays
propagate all the way down the pipeline: if the app at the server
end stops reading data, then the SSH server stops increasing the
window size, and when your client runs out of window it stops
reading data from the local connection, so eventually the app at the
client end sits there blocking and trying to send data - which is
exactly what it _would_ be doing if there wasn't an SSH connection
and a port forwarding in the way. To put it another way, you're
arranging that the total amount of data which can be buffered
between the ultimate endpoints of the connection is _limited_ - so
if the receiver stops receiving, the buffers will all fill up and
eventually the sender will notice.

If you don't do this, your SSH implementation will continue reading
data and buffering it, and will gradually inflate to a ridiculous
size and run out of memory.

Cheers,
Simon
-- 
Simon Tatham         "infinite loop _see_ loop, infinite"
<anakin%pobox.com@localhost>     - Index, Borland Pascal Language Guide



Home | Main Index | Thread Index | Old Index