Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-734

When ClientSessionImpl construction fails, AbstractSessionIoHandler#exceptionCaught may throw NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.0
    • 1.6.0
    • None

    Description

      1. org.apache.sshd.common.session.helpers.AbstractSession#sendKexInit() is called in ClientSessionImpl constructor
      2. org.apache.sshd.common.io.IoSession#write is called
      3. async write is done with handler created by org.apache.sshd.common.io.nio2.Nio2Session#createWriteCycleCompletionHandler()
      4. if e.g., sun.nio.ch.UnixAsynchronousSocketChannelImpl#implWrite() fails, it calls org.apache.sshd.common.io.nio2.Nio2CompletionHandler#onFailed()
      5. org.apache.sshd.common.io.nio2.Nio2Session#exceptionCaught() calls org.apache.sshd.common.io.IoHandler#exceptionCaught()
      6. org.apache.sshd.common.session.helpers.AbstractSessionIoHandler#exceptionCaught() can't find session in AbstractSession.getSession(ioSession, true)
      7. it throws throw new IllegalStateException("No session available", cause) instead of something more related to actual problem

      The solution to "No session available" is simply to attach session in ClientSessionImpl constructor before starting sshd handshake

      There's however more - how to propagate the exception from ClientSessionImpl constructor?

      Attachments

        Issue Links

          Activity

            People

              gnodet Guillaume Nodet
              ggrzybek Grzegorz Grzybek
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: