Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port forwarding: remote server closes connection, but sshj does not close connection to client #686

Open
tsoiland opened this issue May 12, 2021 · 1 comment

Comments

@tsoiland
Copy link
Contributor

TLDR; I have a failing unit test that I think points at a legitimate bug: tsoiland@4a7afbc

I originally had a problem running docker exec (http api) through sshj. From what I've been able to gather it streams data back in the http response and probably doesn't know the content length when it writes the response headers, so the client has to wait until the connection is closed by the server.

When I try to tunnel this through sshj the connection between my http client and sshj is never closed and therefore my http client waits forever.

This works with a direct connection to docker's http server.

It also works tunnelled through openssh-client and I can see the FIN, ACKs on both sides of the tunnel with wireshark.

@tsoiland
Copy link
Contributor Author

  1. I realized while doing some more debugging that my problem is with local port forwarding, not remote like in my linked pull request. New unit test with fix in StreamCopier.java: tsoiland@54b2310

  2. I looked at issue Unable to notify remote exec command of an EOF of the stdin #143, but there the problem seems to be the other way around. Also uncommenting the suggested line doesn't help: trans.write(new SSHPacket(Message.CHANNEL_EOF).putUInt32(chan.getRecipient()));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant