Hi
Yes it is reproducible, but hard. It takes some days to get a single stuck
session, some time more than 1 week. The servers connects to hundreds of
hosts. So it need hundreds of thousands ssh commands to reproduce one
single problem. But it will eventually happen.

Each ssh session runs in its own thread. We thought it was a dead lock in
our code. We used jstack to find out the deadlock. But jstack didn't find
any deadlock, it shown that the thread was running the same lines in
Session.java. That was how we figured out the problem.

We use many SSH servers, most hosts use OpenSSH or SSH2. Yes those servers
rekey a lot.


Pan



                                                                       
  From:       y...@jcraft.com (Atsuhiko Yamanaka)                      
                                                                       
  To:         pa...@prominic.net                                       
                                                                       
  Cc:         jsch-users@lists.sourceforge.net                         
                                                                       
  Date:       2009/06/14 22:57                                         
                                                                       
  Subject:    Re: [JSch-users] NPE and infinite loop under (very) high work load
                                                                       





Hi,

   +-From: Pan Li <pa...@prominic.net> ------
   |_Date: Thu, 11 Jun 2009 12:55:30 +0800 __
   |

I'm interested in this problem.

   |2 infinite loop in Session.java
   |Under very rare condition, Session.java can be stuck in a infinite
loop.
   |I believe it is caused by a possible bug in Session.java.
   |We had to copy timeout checking code from other JSCH class.
   ...

   |--- com/jcraft/jsch/Session.java    (revision 1977)
   |+++ com/jcraft/jsch/Session.java    (working copy)
   |@@ -1142,7 +1142,15 @@
   |   public void write(Packet packet) throws Exception{
   |     // System.err.println("in_kex="+in_kex+" "+
(packet.buffer.getCommand
   |()));
   |-    while(in_kex){
   |+    long timeout = this.getTimeout();
   |+    // in_kex can be always true in some case
   |+    long start = System.currentTimeMillis();
   |+     while(in_kex){
   |+           if (
   |+           timeout>0L &&
   |+        (System.currentTimeMillis()-start)>timeout) {
   |+                  throw new JSchException("timeout writting to
packet");
   |+                    }
   |       byte command=packet.buffer.getCommand();
   |       //System.err.println("command: "+command);
   |       if(command==SSH_MSG_KEXINIT ||

It seems that it has happed in the rare condition, but is it reproducible?

I guess it has happened in the rekeying. If you enable the logger
like Logger.java[1], messages like
  SSH_MSG_KEXINIT sent
  SSH_MSG_NEWKEYS sent
will appear before that problem.

It is easy to drop the session in such a case, but the rekeying should be
successfully finished if possible.  Are there informations to reproduce
that problem?  Which sshd server are you connecting to?

As for other reported problems, I'll resolve them in the next release.
Thank you for your feedback.


Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
    +1-415-578-3454
Skype callto://jcraft/

------------------------------------------------------------------------------

Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

<<inline: graycol.gif>>

<<inline: ecblank.gif>>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to