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

Sometimes async write listener is not called

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.0
    • 2.9.0
    • None

    Description

      Hello,

      I have discovered the case when the async write listener is not called.

      Imagine the case: The `ChannelAsyncOutputStream::doWriteIfPossible` method discover that window size is too small (lines 160-167). It setup new future and exit the doWriteIfPossible method, relying on `onWindowExpanded` will be called shortly. But if the channel is disconnected, the method will never be invoked, thus future won't be completed.

       I suggest adding the following override to ChannelAsyncOutputStream class:

          @Override
          protected void doCloseImmediately() {
              abortCurrentWrite();
              super.doCloseImmediately();
          }
      
          protected synchronized void abortCurrentWrite() {
              IoWriteFutureImpl future = pendingWrite.get();
              if (future != null) {
                  future.setValue(new ClosedChannelException());
              }        
          }
      
      

      Attachments

        Activity

          People

            lgoldstein Lyor Goldstein
            xvost Evgeny Pasynkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 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 - 50m
                50m