I am running into a situation where I end up getting
random results (returned exceptions) when trying to
make multiple SSHExec calls to a host.  Depending on
the system either 10 or <20 calls will work/fail. 
Attached is my  sample test program that demonstrates
the problem I am seeing.  My first pass at what I was
working towards would only run about 4 threads making
multiple calls to collect data (by running commands on
the remote SSHD system) and it's a lot of data so I
was trying to reduce the amount of time it took to
collect the data by running the calls multi threaded. 
Doing 4 was ok, but to increase my performance of
getting the data and reduce the time I went a step
further to where it was running about 50+ threads.  My
initial thought was not to try and kill the system by
making so many calls to it, but I figured that the
system should be able to handle 50+ logons to the
system.

I am getting various errors depending on what version
of jsch I am using however I will only show the errors
I am getting back from jsch-0.1.36.jar.

Error #1
--------
com.jcraft.jsch.JSchException: connection is closed by
foreign host
        at com.jcraft.jsch.Session.connect(Session.java:235)
        at com.jcraft.jsch.Session.connect(Session.java:149)
        at threadedSSHtest.sshcall(threadedSSHtest.java:64)
        at
threadedSSHtest$1runls.run(threadedSSHtest.java:27)
        at java.lang.Thread.run(Unknown Source)
--------
Error #2
--------
com.jcraft.jsch.JSchException: Session.connect:
java.net.SocketException: Connection reset
        at com.jcraft.jsch.Session.connect(Session.java:483)
        at com.jcraft.jsch.Session.connect(Session.java:149)
        at threadedSSHtest.sshcall(threadedSSHtest.java:64)
        at
threadedSSHtest$1runls.run(threadedSSHtest.java:27)
        at java.lang.Thread.run(Unknown Source)
--------

And amazingly enough sometimes I don't get any errors.

Also I have found out that if I do a slight sleep of
about 300 milliseconds then I don't encounter the
problem either.  But it just seems odd that per
connection that it would hit the failures like it
appears to be doing without the sleeps.  I'm guessing
it might be something to do with the session
initializing that it fails on.  However I wanted to
point this failure I noticed out.



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

Attachment: threadedSSHtest.java
Description: 574940509-threadedSSHtest.java

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to