[erlang-patches] ssh synchronous eof

Daniel Goertzen daniel.goertzen@REDACTED
Wed Aug 29 18:18:32 CEST 2012


After looking through the SSH code and learning more about it, I feel this
patch is solving the wrong problem.  The REAL problem is that
ssh_connection:send() is supposed to be synchronous, but is actually not in
some cases.

send() will be synchronous only if the given data will fit in the channel
send window.  Any data beyond that will be sent asynchronously.  So if you
send a very large binary, or repeatedly send smaller binaries you will run
into this problem.

The minimum ssh packet size mandated by the RFCs is 32kB, so the minimum
window is the same.  OpenSSH gives me a send window of approx 200kB.  For
most of the applications that people use SSH for, the send window never
gets overrun and you never see asynchronous send behavior out of Erlang SSH.

Ingela, I'm inclined to write some failing test cases for this and some
other problems I've seen.  Would this be helpful? I have some ideas about
how to fix the problems, but I may not have time to actually fix them.

Dan.


On Tue, Aug 28, 2012 at 3:31 PM, Daniel Goertzen
<daniel.goertzen@REDACTED>wrote:

> When sending a large binary (say a couple of MB) followed by an eof
> through an ssh channel using the following...
>
>
> ssh_connection:send(Conn, Chan, BigBinary),
> ssh_connection:send_eof(Conn, Chan),
>
> ... the eof is transmitted asynchronously and any untransmitted portion of
> BigBinary will be lost.
>
>
> The patch linked below puts eofs through the existing data-send path so
> that all queued send data will be sent before the eof.
>
> The data-send pathway previously only carried {DataType, Data} tuples; it
> may now also carry 'eof' atoms.  To abstractly represent both in the code I
> use the name "Cmd" (Command).
>
>
> Tested on Windows.
>
>
> git fetch git@REDACTED:goertzenator/otp.git ssh_sync_eof
>
> https://github.com/goertzenator/otp/compare/ssh_sync_eof
>
> https://github.com/goertzenator/otp/compare/ssh_sync_eof.patch
>
>
> Dan.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20120829/e4fa7621/attachment.htm>


More information about the erlang-patches mailing list