On Thursday, July 18, 2019 6:49:39 PM CEST Chris Townsend wrote:
> Hi!

Hi Chris,

> In the Multipass project [1], we use an ssh client implementation
> similar to the ssh_client example where connectors are used.  We are
> running into an issue where if a ssh_channel_request_exec() is called
> via the client, that the client can "hang" if it is receiving large
> amounts of data.
> 
> I narrowed this issue down to ssh_connector_fd_out_cb() and the
> ssh_channel_read_nonblocking() call.  Whenever there is more data to be
> read than CHUNKSIZE (which is 4096 bytes), then there is no way for the
> code to go back and read more data on the particular event.  I found
> that increasing CHUNKSIZE to 65536 bytes keeps the issue from
> occurring.  This allows the buffer to be larger than the TCP max buffer
> size and so all data in the packet will be accounted for.
> 
> I would like to propose increasing CHUNKSIZE to 65536, but I'm not sure
> if there is some legacy reason why it's so small or if there is perhaps
> a better way of handling more than 4096 bytes of data to be read on the
> socket.  Also, increasing CHUNKSIZE should increase performance some
> since everything can be read at once and not have to loop through to try
> to see if more data is available.

The channel max packet size is 32768 so I think it shouldn't be bigger than 
that. However doesn't that just hide the problem? I think we should read more 
than once ...


        Andreas


-- 
Andreas Schneider                 [email protected]
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D



Reply via email to