On 12/28/2009 12:12 AM, matsuda wrote: > Hi, > > I have a trouble using (SSH)Exec problem. > It is that "channel object" sometimes fails to detect the close signal. > Can anyone help me? > > While program does polling a remote SSH server by "ls" command, > "if(channel.isClosed())" sometimes doesn't change true forever! > > According to my experience, it occurs after running some nights or > more than 1000 times loop. > > For debug, I add below test message, then it appears. > It shows exit status code changed( from -1 to 0 ), > but channel hasn't closed. > if( !channel.isClosed()&& channel.getExitStatus() == 0 ){ > System.out.println("before close exit-status changed!" ); > } > > > Q1. Is is a known problem? > > Q2. How should I write program to recover this problem?
These are very good questions. I have encountered both recently myself. I also can attest that disconnects I know to exist were not reported by my running application, so either I misunderstand the semantics of Channel.isClosed() and/or Channel.isConnected() or in fact there is a bug in this part of the JSch library. In the course of writing some test code to determine what the actual behavior is (as opposed to what it should be --- there is no spec at this level as far as I can determine) the question arose in my mind: can a Channel object be opened, connected, disconnected and closed multiple times within a single Session object? I will follow up with my experimental results soon. Thanks, -pmr ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ JSch-users mailing list JSch-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jsch-users