GithubHelp home page GithubHelp logo

rport forwarding - unstable about sshj HOT 17 OPEN

hierynomus avatar hierynomus commented on May 30, 2024
rport forwarding - unstable

from sshj.

Comments (17)

pottedplant avatar pottedplant commented on May 30, 2024

to clarify the severity - rport forwarding is useless at the moment. at least under load (concurrent forwarded connections) the connection dies repeatably!

from sshj.

pottedplant avatar pottedplant commented on May 30, 2024

after some debugging i found at least one condition producing the error.

applying this (short) patch issues warnings and ignores some write requests to closed channels.
not intended for production use, just to point devs into the right direction

https://gist.github.com/1732392

for now it seems to work around the issue

from sshj.

shikhar avatar shikhar commented on May 30, 2024

@pottedplant I couldn't reproduce with short-lived connections, will setup some longer ones and try

from sshj.

shikhar avatar shikhar commented on May 30, 2024

thanks for the patch btw, it does point me in the right direction

from sshj.

pottedplant avatar pottedplant commented on May 30, 2024

to trigger the failure or warning (patched) i did setup a port forwarding (not in debug mode, debugger seems to minimize the race condition) against for example a local web server (remote server public port -> ssh -> local web server) and executed something like this:

for i in seq 100; do (curl "http://rport.server:1337/" > /dev/null &); done

this triggers the error almost always

from sshj.

shikhar avatar shikhar commented on May 30, 2024

I will look into the issue this week

from sshj.

sirthias avatar sirthias commented on May 30, 2024

+1 for getting remote port forwarding fixed
(Just bumped into this from scala-ssh)

from sshj.

sirthias avatar sirthias commented on May 30, 2024

Actually I am currently having another issue with remote port forwarding. I can't even get the most basic setup up since the client.getRemotePortForwarder.bind call always triggers this exception:

java.lang.NullPointerException
at net.schmizz.sshj.transport.TransportImpl.write(TransportImpl.java:424)
at net.schmizz.sshj.connection.ConnectionImpl.sendGlobalRequest(ConnectionImpl.java:191)
at net.schmizz.sshj.connection.channel.forwarded.RemotePortForwarder.req(RemotePortForwarder.java:203)
at net.schmizz.sshj.connection.channel.forwarded.RemotePortForwarder.bind(RemotePortForwarder.java:170)

Is there an obvious reason as to what I might be doing wrong?

from sshj.

shikhar avatar shikhar commented on May 30, 2024

@sirthias I think your issue is because you are not yet connected on the SSHClient. That said you might run into the original issue, I'll look into that one as soon as I get a chance.

from sshj.

sirthias avatar sirthias commented on May 30, 2024

Ok, might be. I'll look into it.
Still, I think an NPE is always a bug.
Ideally the API shouldn't let me do things before the connection has been established.
At least it should throw a proper exception explaining the issue.
What would be the best way for me to wait for the connection to be completed before doing anything else?

from sshj.

shikhar avatar shikhar commented on May 30, 2024

I agree an NPE is always a bug. I'll add exceptions for these cases where it's required that connection have been established. I am also looking at refactoring the SSHClient API.

sshClient.connect() is synchronous so as long as you are using sshClient.getRemotePortForwarder.bind after that it should be fine.

from sshj.

sirthias avatar sirthias commented on May 30, 2024

Thanks, Shikhar, I was indeed calling bind before connect.
I think for the time being it'd be enough to simply render a proper error message if the user doesn't abide by the implicit API rules of calling connect before anything else.

Fixing the remote port forwarding is probably the more pressing issue.

Thanks for making and maintaining sshj!

from sshj.

shikhar avatar shikhar commented on May 30, 2024

the 'Received data for nonexistent channel' bug should be fixed in 0.9.0-SNAPSHOT

from sshj.

 avatar commented on May 30, 2024

Hi Shikhar. After upgrading to 0.9.0-SNAPSHOT I keep recieving: "Received data for nonexistent channel".
The problem occurs when I pass multiple connections through SSH Session. Some of them could be started "concurently" or one by one and most of them are short living. All connections are .
Server is OpenSSH-4.3

from sshj.

shikhar avatar shikhar commented on May 30, 2024

Thanks for the feedback, will investigate...

from sshj.

 avatar commented on May 30, 2024

Hello @shikhar is there any news regarding this issue?

from sshj.

hierynomus avatar hierynomus commented on May 30, 2024

Could somebody write a unit test for this so that we can solve it, it seems like a bug...

from sshj.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.