mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bkuker <...@git.apache.org>
Subject [GitHub] mina-sshd pull request #33: Tests & Candidate fix for SSHD-85.
Date Thu, 22 Jun 2017 15:45:43 GMT
GitHub user bkuker opened a pull request:


    Tests & Candidate fix for SSHD-85.

    SSHD-85 is a bug that occurs on Windows where the last few bytes of data sent through
a port forward can be lost when the server at the far end of the port forward sends the data
and immediately closes the socket.
    An example of this server behavior would be HTTP 1.0 with the Connection: close header.
The server sends the data, and then closes the socket to indicate that it is done sending
data. The server does not send a Content-Length header or similar. This is a stupid way to
do it, all modern http servers do better, but there are still old embedded systems that work
this way, and it does impact my use case.
    The test cases include some sleeps on the client end. This seems to be a race condition
that occurs possibly one time in a hundred or more, but these sleeps cause it to happen every
single time.
    The test cases include two controls: JSCH as the client
    During testing I did verify that the test server did send all data to the ssh client by
examining the buffers in the ssh client and seeing all of the data. I then verified that all
of the data was transferred from the ssh client to the ssh server by examining the buffers
in the sshd server.  The sshd server does write all of that data to the socket as far as I
can tell, but on Windows some still goes missing at the end! I also verified that on Local
port forwards the error does occur with Apache SSHD as the client, and does NOT occur with
JSCH as the client. I would like to try that the other way around with Apache SSH Client and
another server, but the pickings for Java SSH servers are slim, and this one is the best!
    I am currently trying to understand WHY the fix (basically one line, getSocket().shutdownOutput())
fixes the problem. I am submitting this PR now in hopes that someone with a better understanding
will point out why it is the correct fix and accept it. All I can say at the moment is that
it works.
    Also includes a fix for a test in PortForwardingLoadTest which was failing for me before
I started investigating. Frankly it looks like it never worked; I would guess that there was
some copy-paste mistake in the past when it got updated to use try-with-resources.
    I am ... very motivated to get this fixed so I do not have to maintain my own private
branch of sshd, so please ask questions, make suggestions, if you think I am totally crazy
help me prove that I am not!

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/bkuker/mina-sshd sshd-85

Alternatively you can review and apply these changes as the patch at:


To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #33
commit e6e400b24fe5d4d6778135e1ae5e38fb8ac3631a
Author: bkuker <bkuker@martellotech.com>
Date:   2017-06-14T12:20:41Z

    Tests for SSHD-85

commit fe92dc673678e66374d2a095a2299b8e60425c98
Author: bkuker <bkuker@martellotech.com>
Date:   2017-06-20T15:01:56Z

    The Fix?

commit 5842c850485835a98385937df7bb74b0ca4c4889
Author: bkuker <bkuker@martellotech.com>
Date:   2017-06-22T13:13:57Z

    This test failed before my changes. It made no sense as it was.


If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message