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

Not all messages are correctly handled in port forwarding mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • None
    • Important

    Description

      There are some race conditions so that in port forwarding mode, not all messages are correctly managed during connections phase, leading to NullPointerException

       

      The problem is caused in 

      DefaultForwardingFilter.messageReceived

       where

                  OpenFuture future = channel.getOpenFuture();
                  Consumer<Throwable> errHandler = future.isOpened() ? null : e -> {
                      try {
                          exceptionCaught(session, e);
                      } catch (Exception err) {
                          log.warn("messageReceived({}) failed ({}) to signal {}[{}] on channel={}: {}",
                              session, err.getClass().getSimpleName(), e.getClass().getSimpleName(),
                              e.getMessage(), channel, err.getMessage());
                      }
                  };
                  ClientChannelPendingMessagesQueue messagesQueue = channel.getPendingMessagesQueue();
      
      

      should be 

                  ClientChannelPendingMessagesQueue messagesQueue = channel.getPendingMessagesQueue();
                  
                  OpenFuture future = messagesQueue.getCompletedFuture();
                  Consumer<Throwable> errHandler = future.isOpened() ? null : e -> {
                      try {
                          exceptionCaught(session, e);
                      } catch (Exception err) {
                          log.warn("messageReceived({}) failed ({}) to signal {}[{}] on channel={}: {}",
                              session, err.getClass().getSimpleName(), e.getClass().getSimpleName(),
                              e.getMessage(), channel, err.getMessage());
                      }
                  };
      
      

      Since the ClientChannelPendingMessagesQueue is a listener of the channel's OpenFuture, this latter can be in open state but the ClientChannelPendingMessagesQueue's completed feature could be not, so that messages won't be correctly handled and a null errHandler is passed to ClientChannelPendingMessagesQueue.handleIncomingMessage

       

       

      Attachments

        Issue Links

          Activity

            People

              lgoldstein Lyor Goldstein
              fcava Fulvio Cavarretta
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h