[ 
https://issues.apache.org/jira/browse/SSHD-1287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Wolf resolved SSHD-1287.
-------------------------------
    Fix Version/s: 2.9.2
       Resolution: Fixed

The bugs are fixed:
 * Use _remote_ window packet size for default write buffer size
 * Correctly transfer data if read buffer size > twice the server's maximum 
response limit

(The server's maximum response limit is defined by 
{{{}SftpModuleProperties.MAX_READDATA_PACKET_LENGTH{}}}.)

The following enhancements mentioned in comments are deferred to later changes:
 * Increasing that server-side limit (default is currently 63kB).
 * Client-side: make use of {{lim...@openssh.com}} information to set buffer 
sizes.

> Use the maximum packet size of the communication partner
> --------------------------------------------------------
>
>                 Key: SSHD-1287
>                 URL: https://issues.apache.org/jira/browse/SSHD-1287
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.8.0
>            Reporter: Ryosuke Kanda
>            Assignee: Thomas Wolf
>            Priority: Minor
>             Fix For: 2.9.2
>
>         Attachments: ClientMain.java, ConsoleLog, ServerMain.java
>
>
> It appears that SSHD may use the maximum packet size presented by the 
> communicating party to request reception.
> RFC 4254 contains the following statement, where "maximum packet size" can be 
> read as "the maximum packet size that the sender is willing to accept" (as in 
> "initial window size").
> {code:java}
> Section 5.1 Opening a Channel
> The 'maximum packet size' specifies the maximum size of 
> 2an individual data packet that can be sent to the sender.{code}
> The client/server must comply with its own declared maximum packet size.
>  
> I encountered this issue when I was using "freeSSHd" as an SFTP server.
> The version of freeSSHd is 1.3.1.
> The event is confirmed by creating a server with SSHD.
> Attached are the client and server sources, as well as the client debug logs 
> (up to the first read request).
> When communicating with these, the client knows that its maximum packet size 
> is "32768" and the server's maximum packet size is "65536".
> {code:java}
> // client window
> [main] DEBUG org.apache.sshd.common.channel.Window - 
> init(Window[client/local](SftpChannelSubsystem[id=0, 
> recipient=-1]-ClientSessionImpl[user@localhost/127.0.0.1:10022][sftp])) 
> size=2097152, max=2097152, packet=32768
> // server window
> [sshd-SshClient[5702b3b1]-nio2-thread-3] DEBUG 
> org.apache.sshd.common.channel.Window - 
> init(Window[client/remote](SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[user@localhost/127.0.0.1:10022][sftp])) 
> size=2097152, max=2097152, packet=65536 {code}
> And when requesting to receive a file, it requests to read 65536 bytes at a 
> time. This means that it attempts to receive packets that exceed 32768 bytes.
> {code:java}
> [main] TRACE org.apache.sshd.sftp.client.impl.SftpInputStreamAsync - 
> sendRequests(SftpInputStreamAsync[ClientSessionImpl[user@localhost/127.0.0.1:10022]][/data4M.txt])
>  enqueue pending ack: SftpAckData[id=103, offset=0, length=65536] {code}
>  
> I hope this report is helpful.
> I am doing machine translation, so please allow it to be unnatural.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to