ezhaka opened a new issue, #626:
URL: https://github.com/apache/mina-sshd/issues/626

   ### Version
   
   2.14.0
   
   ### Bug description
   
   I'm trying to use `Streaming.Async` together with `ChannelDirectTcpip`:
   
   ```
   val channel = session.createDirectTcpipChannel(localAddress, remoteAddress)
   channel.streaming = Streaming.Async
   channel.open().verify(10, TimeUnit.SECONDS)
   
   // writing something to the in channel works correctly
   channel.asyncIn.writeBuffer(ByteArrayBuffer(byteArray))
   
   // ...but when I try to read output, it throws NPE
   sshChannel.asyncOut.read(outBuffer)
   ```
   
   ### Actual behavior
   
   NPE is the following:
   
   ```
   java.lang.NullPointerException: null
        at 
org.apache.sshd.client.channel.ChannelDirectTcpip.doWriteData(ChannelDirectTcpip.java:119)
        at 
org.apache.sshd.common.channel.AbstractChannel.handleData(AbstractChannel.java:845)
        at 
org.apache.sshd.common.session.helpers.AbstractConnectionService.channelData(AbstractConnectionService.java:585)
        at 
org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:466)
        at 
org.apache.sshd.common.session.helpers.CurrentService.process(CurrentService.java:109)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:625)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.lambda$handleMessage$0(AbstractSession.java:546)
        at 
org.apache.sshd.common.util.threads.ThreadUtils.runAsInternal(ThreadUtils.java:68)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:545)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1729)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:506)
        at 
org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:409)
        at 
org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:382)
        at 
org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:377)
        at 
org.apache.sshd.common.io.nio2.Nio2CompletionHandler.lambda$completed$0(Nio2CompletionHandler.java:38)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at 
org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:37)
        at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:127)
        at java.base/sun.nio.ch.Invoker$2.run(Invoker.java:219)
        at 
java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
   ```
   
   This NPE is expected, because `pipe` is indeed null here:
   
   
https://github.com/apache/mina-sshd/blob/master/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java#L119
   
   Becuase it's set only when streaming is sync:
   
   
https://github.com/apache/mina-sshd/blob/master/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelDirectTcpip.java#L109
   
   Shouldn't `doWriteData` be called at all or it has incorrect implementation 
in the case of async streaming?
   
   ### Expected behavior
   
   I expect that reading from `asyncOut` works without exceptions. 
   
   ### Relevant log output
   
   _No response_
   
   ### Other information
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to