Comments (17)
to clarify the severity - rport forwarding is useless at the moment. at least under load (concurrent forwarded connections) the connection dies repeatably!
from sshj.
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.
@pottedplant I couldn't reproduce with short-lived connections, will setup some longer ones and try
from sshj.
thanks for the patch btw, it does point me in the right direction
from sshj.
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.
I will look into the issue this week
from sshj.
+1 for getting remote port forwarding fixed
(Just bumped into this from scala-ssh)
from sshj.
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.
@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.
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.
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.
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.
the 'Received data for nonexistent channel' bug should be fixed in 0.9.0-SNAPSHOT
from sshj.
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.
Thanks for the feedback, will investigate...
from sshj.
Hello @shikhar is there any news regarding this issue?
from sshj.
Could somebody write a unit test for this so that we can solve it, it seems like a bug...
from sshj.
Related Issues (20)
- NullPointerException on `OpenSSHKeyV1KeyFile.java` HOT 2
- Regression writing known host entry key string
- SSHJ usage on Android app in Kotlin HOT 2
- No initialization of public key depending on constructor usage of file key provider
- False-alarm timeout exception when waiting for key exchange to complete HOT 1
- Bad packet received by server when hearbeat is enabled HOT 1
- SFTP RSA negotiation vulnerability HOT 3
- [Feature request] compatibility with OTP
- Terrapin Vulnerability CVE-2023-48795 HOT 1
- Does CVE-2023-48795 affect sshj ? HOT 4
- Suggestions on Improving the Security Algorithm for Calculating Fingerprints HOT 1
- Support for connected sockets HOT 1
- I have tried to disconnect the sshclient in my java code, but the operating system did not disconnect port 22? HOT 2
- SCP upload to Windows 11 Open SSH fails with no such file or directory error HOT 3
- RemoteFile.RemoteFileInputStream does not hanbdle read with len=0 correctly
- Invalid algorithm identifier
- Failed to connect to higher version OpenSSL server after configuring KeepAliveInterval HOT 3
- use watchdog to close session failed. HOT 2
- connection problems with terrapin mitigation
- passing in StrictHostKeyChecking=no
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sshj.