MINA SSHD
  1. MINA SSHD
  2. SSHD-145

InvertedShellWrapper may not send process output back if process exits too fast

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.5.0
    • Fix Version/s: 0.7.0
    • Labels:
      None
    • Environment:
      Usually does not reproduce on windows, often on linux (Ubuntu 11.04)

      Description

      In InvertedShellWrapper, pumpStreams() method first checks if the process is alive, and only then pumps streams. It could happen that after the process has already exited, some information is left out in out or err streams. Moving the check for shell.isAlive() after all pumpStream() calls seems to resolve the issue.

      I've uploaded a patch for your convenience here https://gist.github.com/1206056

      steps to reproduce:

      1. create a default server
      2. set command factory as described at http://mina.apache.org/sshd/tips.html
      3. run `ssh localhost -p 8000 echo test`

      expected result:
      command output is `test`

      actual result:
      usually nothing is printed even though the command is executed

      1. patch-with-test.patch
        7 kB
        Pierre-Etienne Poirot

        Issue Links

          Activity

          Hide
          Tim Vernum added a comment -

          This looks like a duplicate of SSHD-125

          Show
          Tim Vernum added a comment - This looks like a duplicate of SSHD-125
          Hide
          Denis Tulskiy added a comment -

          Sorry, didn't search good enough. It is a duplicate.

          Show
          Denis Tulskiy added a comment - Sorry, didn't search good enough. It is a duplicate.
          Hide
          Pierre-Etienne Poirot added a comment -

          Added path-with-test.patch, which is Denis's patch plus a simple JUnit test.

          Show
          Pierre-Etienne Poirot added a comment - Added path-with-test.patch , which is Denis's patch plus a simple JUnit test.
          Hide
          Guillaume Nodet added a comment -

          Patch applied. Thx a ton Denis and Pierre.

          Show
          Guillaume Nodet added a comment - Patch applied. Thx a ton Denis and Pierre.

            People

            • Assignee:
              Guillaume Nodet
              Reporter:
              Denis Tulskiy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development