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

Evgeny Pasynkov commented on SSHD-1032:
---------------------------------------

Nope, the buffer is not reused. The write loop looks like this (in Kotlin): - 
it just reads data portion from pipe and sends it into SSH channel
{code:java}
do {
    val buffer = ByteArray(8192)
    val read = pipe.read(buffer)
    if (read > 0) {
        try {
            ioOut.writePacket(ByteArrayBuffer(buffer, 0, read, 
true)).awaitWrite()
        } catch (ex: Throwable) {
            throw IOException("Error writing $read bytes. Channel: ${ioOut}", 
ex)
        }
    }
} while (read > 0)

{code}
I will do exhaustive testing tomorrow with debug logging enabled, and hopefully 
will provide logs with more details

> java.lang.ArrayIndexOutOfBoundsException arraycopy
> --------------------------------------------------
>
>                 Key: SSHD-1032
>                 URL: https://issues.apache.org/jira/browse/SSHD-1032
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.5.0
>            Reporter: Evgeny Pasynkov
>            Priority: Major
>
> When invoking writePacket, I quite often get the following exception:
> {noformat}
> Caused by: java.lang.ArrayIndexOutOfBoundsException arraycopy: last source 
> index 32768 out of bounds for byte[8192] 
> at java.base/java.lang.System.arraycopy(Native Method) 
> at 
> org.apache.sshd.common.util.buffer.ByteArrayBuffer.putRawBytes(ByteArrayBuffer.java:230)
>  
> at 
> org.apache.sshd.common.channel.ChannelAsyncOutputStream.createSendBuffer(ChannelAsyncOutputStream.java:229)
>  
> at 
> org.apache.sshd.common.channel.ChannelAsyncOutputStream.doWriteIfPossible(ChannelAsyncOutputStream.java:164)
>  
> at 
> org.apache.sshd.common.channel.ChannelAsyncOutputStream.writePacket(ChannelAsyncOutputStream.java:70){noformat}
> This never happened in 2.4.0, so it is definitely a regression



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to