On 12/29/2009 03:55 AM, Paul Michael Reilly wrote:
> 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.
I still do not have a good feel whether there is a bug in the
Channel/Session classes wrt disconnect and closing not being detected
and reported properly. I think there is but would be hard pressed to
clearly state what it is.
The new application code I have written to work around this very real
problem tries to force the issue by opening a short lived ChannelExec
connection and executing a simple (date) command. The theory being that
if the Session has died (been closed or disconnected but still reports a
connected status) then the death will be revealed for sure in the
attempt to transfer bytes. Once the workaround can be shown to be
working I will attempt to find the real problem with the library while
still having a useful application. I expect it will take much effort
and considerable time.
-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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users