[ 
https://issues.apache.org/jira/browse/SSHD-634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15130093#comment-15130093
 ] 

Goldstein Lyor commented on SSHD-634:
-------------------------------------

Without going into too much details, using a lot of small buffers introduces 
memory fragmentation and also waste - for sending back ~8-10 bytes of data you 
are wrapping it into an entire Java object, which has to be tracked, garbage 
collected, etc. - a whole lot of resources for just a few bytes. However, you 
are right and if you look at SSHD-639 you will see that I will greatly reduce 
the re-use of buffers and use a model similar to what you are suggesting.

> Suspicious read buffer re-use in write command
> ----------------------------------------------
>
>                 Key: SSHD-634
>                 URL: https://issues.apache.org/jira/browse/SSHD-634
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Eugene Petrenko
>            Assignee: Goldstein Lyor
>             Fix For: 1.2.0
>
>
> From time to time I saw a {{Bad packet length ###}} errors from SSH clients 
> that calls commands to the SSHD server running with Apache SSHD. 
> It may turn out there are some issues in the implementation. 
> I found one suspicious usage of buffers around 
> {{org.apache.sshd.common.channel.AbstractChannel#sendResponse}} method. As 
> far as I see from the code it uses the read buffer as a place to generate a 
> write packet command. Maybe it's worth to create a fresh buffer here to avoid 
> it be updated from the other thread while it is put to a write queue



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to